Republican presidential frontrunner Donald Trump. George Frey/Getty Images Donald Trump abruptly reversed course Wednesday, after he caused a firestorm by suggesting that women should be punished for having abortions in a hypothetical world in which the practice was made illegal in the US.

Trump's campaign released a statement Wednesday afternoon suggesting that women should not be held legally responsible for obtaining abortions if the practice were banned.

In the statement, he said:

If Congress were to pass legislation making abortion illegal and the federal courts upheld this legislation, or any state were permitted to ban abortion under state and federal law, the doctor or any other person performing this illegal act upon a woman would be held legally responsible, not the woman.

The woman is a victim in this case as is the life in her womb. My position has not changed — like Ronald Reagan, I am pro-life with exceptions.

Hours earlier, the Republican presidential frontrunner inflamed controversy after after being repeatedly questioned on the subject of abortion by MSNBC's Chris Matthews during a pretaped town-hall event.

"There has to be some form of punishment," Trump said.

After Matthews asked Trump if he's for women being imprisoned for lengthy sentences, Trump said the exact punishment would be "something we have to decide on."

Trump said:

They've set the law and frankly the judges, you're going to have a very big election coming up for that reason because you have judges where it's a real tipping point and with the loss of [Antonin] Scalia, who was a very strong justice, this presidential election is going to be very important.

He added that the legality of abortion depends on the November election.

There is a vacancy on the Supreme Court, and the next president might have the opportunity to appoint several justices. In Roe v. Wade, the Supreme Court ruled in 1973 that women possess a constitutional right to have abortions.

"When you say what's the law, nobody knows what the law is going to be," Trump said Wednesday. "It depends on who gets elected."

Trump also said that he understood women would have to resort to going to "illegal places" to have an abortions should the law change, but "you have to ban it."

His statement to Matthews drew sharp rebuke from a number of advocates and politicians who support abortion rights. Democratic presidential candidates Bernie Sanders and Hillary Clinton called Trump's comments "shameful" and "horrific," respectively.