“I’m leaving because of a misogynistic culture that gleefully consumed my naked pictures, capitalized on my sexuality and enabled my abusive ex to continue that abuse, this time with the entire country watching,” Ms. Hill said. “I am leaving because of the thousands of vile, threatening emails, calls and texts that made me fear for my life and the lives of the people that I care about.”

Ms. Hill, 32, said Sunday she would resign in the face of an ethics investigation into allegations that she had a sexual relationship with a member of her congressional staff, a violation of House rules that she had denied. The allegation was first reported by RedState and emerged as part of her divorce proceedings with Mr. Heslep.

The House Ethics Committee investigation into Ms. Hill makes her the first representative to be investigated under a rule passed last year amid the #MeToo movement that prohibited members of Congress from having sexual relationships with their staff members. After years of complaints about male lawmakers engaging in sexual harassment, the first casualty of the new House rules is a woman. To Ms. Hill’s critics — including Republicans who want to reclaim her seat in a relatively conservative district — she brought dishonor to her office. But the role of Ms. Hill’s husband and the release of her naked pictures has led her supporters to argue that she is a victim of “revenge porn,” the nonconsensual publication of sexual images.

Revenge porn is illegal in 40 states, including California, and Ms. Hill has said she referred the matter to law enforcement.

RedState separately reported that Ms. Hill, who is bisexual, was involved in a three-way relationship with her husband and a female campaign aide. Ms. Hill has acknowledged being in a relationship with the campaign aide, which is not covered by House rules.