Federal law bans those who have been convicted of certain crimes from ever possessing firearms. Included in those crimes are all felonies and misdemeanor domestic violence offenses. (The law also prohibits those subject to domestic violence restraining orders from having a gun.) (18 U.S.C. § 922(g).) State law often overlaps with this ban; for example, in California, convictions for misdemeanor domestic violence offenses bar offenders from owning or possessing guns within 10 years of conviction. (Cal. Penal Code § 29800 et seq.)
Federal law allows for the restoration of gun possession rights if the conviction in question has been expunged or set aside, or if the person has been pardoned or had civil rights restored. (But if the action that would otherwise reestablish the right to gun possession explicitly provides that it doesn’t, then the person still cannot have a gun.) Likewise, there is a procedure by which people can seek exemption from the federal prohibition, and, depending on the circumstances, state law may provide for the equivalent. But whether expungement or similar relief will restore the right to possess a gun under state law depends on the underlying offense and, of course, the jurisdiction.
To read up on gun possession rights, see Gun Possession and Use Laws and Gun Ownership Rights Under Heller. Also see What kind of “domestic violence” conviction prevents you from having a gun? and Can a past misdemeanor that’s technically not “domestic violence” prohibit you from having a gun?
To learn how the law applies to your specific situation, speak with a knowledgeable criminal defense lawyer.