Those votes, and her firm opposition to abortion, cost her re-election in 1982. As a result of redistricting, she was thrown into a new district with a freshman Democrat, Barney Frank. Though two-thirds of the voters came from her old district and only one-third from his, he won with 60 percent of the vote. Women’s groups turned on her over abortion, and Mr. Frank used those pro-Reagan votes on taxes and spending against her.

Looking toward the 1984 election after big Republican losses in 1982, the Reagan administration was concerned that polls showed women taking a dimmer view of the president than men did. To smooth over those differences, the White House in 1983 sought to put women in high-visibility posts and chose Mrs. Heckler to head Health and Human Services.

She acknowledged in an interview for this obituary in 2011 that she had gotten the post even though she had shown no outward qualifications for it.

“I had never been in charge of a bureaucracy,” she said. “I had never known anything about medicine.”

Her approach, she said, was to be a “catalyst for caring.”

The AIDS epidemic tested that goal, as she coped with the White House’s insistence on holding down spending. Learning of the disease only when she took office in March 1983, she designated it the “No. 1 priority” for her department.

But she warned in June of that year against “unwarranted panic” and “irrational fears.” She told the United States Conference of Mayors that “for the overwhelming majority of Americans, there appears to be little or no risk of falling victim to this disease.”