Ms. Ernst’s story drew expressions of shock and support from lawmakers of both parties.

“My heart goes out to her,” Representative Debbie Dingell, Democrat of Michigan, said on CNN on Thursday.

A conservative favorite, Ms. Ernst was interviewed as a potential running mate for Donald J. Trump during the 2016 campaign. She declined to be considered, citing family concerns, the court documents showed.

“I understand it’s newsworthy, but this is a huge violation of her privacy,” said Karen Kedrowski, director of the Carrie Chapman Catt Center for Women and Politics at Iowa State University. “It would not surprise me if some people would see a disconnect between her personal experience and public positions and see this as hypocrisy. But I think that undercuts the human capacity to compartmentalize and see personal experience in a different frame of reference.”

The release of the court documents meant Ms. Ernst lost control of her own story. But her decision to speak publicly put her in the company of other women who have had to balance forthrightness and transparency about traumatic experiences against the potential loss of privacy and other negative effects on their lives and careers.

In Congress, Ms. Ernst and Senator Kirsten Gillibrand, Democrat of New York, have advocated on behalf of victims of sexual assault in the military. On a visit to Iowa last spring, Ms. Ernst promised to seek more reliable federal funding for Iowa’s Rape Victim Advocacy Program, whose leaders complained that state budget cuts had defunded the state’s 24-hour sexual abuse hotline and forced the advocacy program to cut staffing.

But Ms. Ernst was also among female legislators casting doubt on the testimony of Christine Blasey Ford, the educator whose allegations of high school sexual assault by Justice Brett M. Kavanaugh nearly derailed his Supreme Court nomination.

“I’m glad that she is here, and it’s important that we hear from her,” Ms. Ernst told reporters at the time. “However, the other statements provided by those witnesses have contradicted what she is stating.” Ms. Ernst voted to confirm Justice Kavanaugh.