The South Carolina legislature has passed a bill making it illegal for a woman to get an abortion at 20 weeks or more, even if she has been raped or is a victim of incest.

The passage of the legislation, which is headed to Gov. Nikki R. Haley’s desk, would make South Carolina the 17th state to approve such a ban. Ms. Haley, a Republican, said in March she “can’t imagine any scenario in which I wouldn’t sign it.”

The Republican-controlled chamber voted 79-29 late Tuesday to approve the measure, which would allow exceptions only if the mother’s life was in jeopardy or a doctor determined that the fetus could not survive outside the womb.

Reaction to the vote was swift. Alyssa Miller, the state’s director of public affairs for Planned Parenthood South Atlantic, said in a statement that the bill was “dangerous” for women, and that it was “made even more extreme by removing exceptions for victims of rape and incest.”