WASHINGTON—Reproductive-rights advocates saw some momentum during a dramatic week in which the Supreme Court maintained widespread access to abortion pills and Republicans were put on the defensive over whether they support in vitro fertilization.

The rapidly unfolding events came as abortion and fights over related issues such as IVF and contraception are expected to drive turnout in the 2024 election. President Biden has campaigned aggressively on a pledge to protect abortion following the 2022 Supreme Court ruling that eliminated the right to the procedure . Former President Donald Trump has taken credit for appointing justices who joined that decision but has struggled to articulate a message and has warned fellow Republicans that the issue is perilous for them.

The country’s largest Protestant denomination also came out against the use of IVF this week, keeping it at the center of a debate playing out from churches to the U.S. Capitol.

On Thursday, the Supreme Court unanimously rejected an effort seeking to restrict access to the abortion pill mifepristone , ruling that a group of antiabortion doctors who filed suit had no legal standing to challenge Food and Drug Administration regulations for prescribing the drug. The ruling ensures the pills will for now remain widely available but certainly won’t end the legal and political fight over the most common method for ending a pregnancy in the U.S.

While Democrats applauded that access to the drug remains in place, they cautioned that the ruling was reached on procedural grounds and that threats to abortion access continue. Biden campaign manager Julie Chavez Rodriguez said: “This case—brought on by Donald Trump’s allies—was only one tactic in a broader, relentless strategy to strip away access to reproductive freedom everywhere in this country.”

Trump, on Capitol Hill Thursday, acknowledged that the abortion subject was a vulnerability, telling GOP lawmakers that abortion politics cost the party in recent elections, and that they can’t ignore the topic but need to talk about it carefully, according to two Republicans in the room. Trump also said Republicans should say they support exceptions to banning abortion—for rape, incest and the life of the mother, according to one of the lawmakers. Trump has previously said he supports IVF.

Trump’s campaign reacted to the Supreme Court ruling Thursday by saying in a statement the matter was “settled,” without praising or criticizing the decision. The campaign also said Trump supported leaving decisions about abortion to the states and accused the Biden campaign of lying about the former president’s views.

The ruling provided another moment for the Biden campaign to focus on abortion, an issue that could help the president over the finish line in a close race. Vice President Kamala Harris joined an organizing call on the topic Thursday night. The campaign is also planning events around the anniversary of the 2022 ruling that overturned Roe v. Wade, which is on June 24.

New polling from Gallup shows that 32% of registered voters say they will only vote for candidates who share their views on abortion, which includes 23% who support abortion rights and 8% who oppose. Before 2022, that split was more even.

Since March 13, when both Trump and Biden became the presumptive nominees, the incumbent and his allies have spent heavily on broadcast television ads featuring abortion. Abortion was the issue most frequently mentioned in their ads in the seven states expected to be the most competitive, data from AdImpact shows. Almost a third of spots aired by Biden and his allies in those states mentioned abortion, with spending totaling more than $15 million.

Abortion isn’t a topic often addressed by Trump and his allies in broadcast ads. The top issues referred to by them are immigration, inflation and crime.

Senate Republicans also tried to play defense on IVF access Thursday as Democrats forced a vote on a bill enshrining access to the procedure into law, seeking to put Republicans on the record opposing the practice. The vote came a day after the Southern Baptists, the country’s largest Protestant denomination, voted to oppose the use of in vitro fertilization as it is commonly practiced.

All 49 Republicans in the chamber signed a letter backing IVF, and they argued that Democrats had drafted overly broad legislation designed to score political points and scare voters. Democrats say the IVF package is needed to head off fresh challenges to the procedure.

Polling has shown broad bipartisan support for IVF. The Gallup poll showed that 82% of Americans saw IVF as “morally acceptable.” That includes 89% of Democrats, 84% of Independents and 72% of Republicans.

IVF has emerged as a newly potent political issue after the Alabama Supreme Court in February ruled that frozen embryos are children and providers in the state paused services until the state’s legislature passed a law shielding them from liability. 

The fight over abortion access is also playing out in several states.

More than a dozen states have banned most abortions, a number that remains in flux two years after the overturning of Roe. Earlier this year, the Arizona Supreme Court revived a  Civil War-era ban on abortion before lawmakers repealed the law. A six-week ban took effect in Florida this past month.  

Abortion-rights groups have gone on offense in even some of the country’s more conservative states after winning a string of referendum victories in places as politically diverse as Kansas and Ohio. Measures to protect abortion rights could be on the ballot in half a dozen or more states this November, including political battlegrounds such as Arizona, Montana and Florida.

In Ohio, advocates are using a measure that passed in November to try to challenge longstanding state laws, including waiting periods and rules requiring doctors to look for fetal cardiac activity before performing an abortion.

The abortion-pill debate is also likely to continue. The FDA challenge was the most prominent move by antiabortion groups on a national scale since Roe was overturned, but it rested on some novel legal arguments. Antiabortion groups were adamant Thursday that they will continue to find legal and political avenues to restrict access to abortion pills.

“This is only the beginning frankly,” said Students for Life Action spokeswoman Kristi Hamrick .

Another strategy by antiabortion groups involves trying to revive the Comstock Act , a 19th-century federal law that banned mailing abortion drugs over state lines. Some advocates have been urging a potential future Trump administration to enforce the law, which could ignite a new national fight over abortion pills.

Sen. Tina Smith (D., Minn.) said she plans next week to introduce a bill to repeal the Comstock Act. Republican legislators in Congress have introduced bills to ban Medicare funds from going to doctors who prescribe the abortion pill via telehealth, prohibit the FDA from approving any new drugs to terminate pregnancies and strip funding from colleges that host health services that provide abortion drugs.

Write to Catherine Lucey at catherine.lucey@wsj.com and Laura Kusisto at Laura.Kusisto@wsj.com