A federal judge on Friday temporarily blocked a Kentucky law that prohibits abortion after a fetal heartbeat is detected, which typically happens around six weeks into pregnancy, before many women know they are pregnant.

The measure, which was signed into law on Friday by the state’s Republican governor, Matt Bevin, and was set to take effect immediately, was poised to become one of the strictest anti-abortion laws in the country.

But late on Friday, the judge, David J. Hale of the Western District of Kentucky, ruled the law was potentially unconstitutional. He halted enforcement for at least 14 days to “prevent irreparable harm” until he could hold a hearing.

The ruling came amid a yearslong effort to curb abortions in Kentucky, which has one remaining abortion clinic. Several other states are considering similar measures, known as heartbeat bills, as states move to restrict — or shore up access to — abortion in anticipation of a more conservative Supreme Court possibly ruling on the issue.

The Kentucky law was one of two measures seeking to restrict abortion that were passed by the state’s Republican-controlled legislature this week but are now being contested. The other, a bill that prohibits abortion if a woman wants to end her pregnancy because of the diagnosis of a disability in the fetus, among other reasons, is awaiting approval from the governor.

The American Civil Liberties Union challenged both measures in a lawsuit filed this week on behalf of EMW Women’s Surgical Center, the state’s only licensed abortion clinic.

The judge on Friday did not address the second bill and Ms. Amiri said the group planned to ask the judge for a ruling on it after it was signed into law.

Steve Pitt, general counsel to the governor, said on Saturday that ruling was not unexpected “given the minimal amount of briefing that has occurred.”

“This case or others like it from other states will result in major changes in abortions in the U.S. in the near future,” he said. “The A.C.L.U., Planned Parenthood and others favoring unlimited abortions know this and are in a panic.”

In a video message on Friday, he chided his “good friends at the A.C.L.U.” for challenging the second bill, which would ban abortions based on a fetus’s disability, sex or race, before it had been signed into law and suggested they needed a civics refresher from “Schoolhouse Rock!” on how legislation works.

“They frankly don’t care whether they are following the law or not,” said Mr. Bevin, who has expressed support for the bill. “They simply want to push their ideology.”

The landscape of the Supreme Court changed last year after Justice Brett M. Kavanaugh, seen as a reliable conservative, replaced the court’s longtime swing vote, Justice Anthony M. Kennedy, who retired. The change added urgency to the question of whether Roe v. Wade, the landmark 1973 ruling that made abortion legal nationwide, would survive the Trump administration.

But legal experts have suggested that any developments, at least in the near term, will most likely come at the state level, with states succeeding in smaller cases that limit — but not eliminate — the right to an abortion. Other states, including Iowa and North Dakota, have passed similarly prohibitive fetal heartbeat measures only to have them swiftly voided by the courts as unconstitutional.

Supreme Court decisions have given women a right to abortion until a fetus is viable outside the womb, usually around 24 weeks into pregnancy.

Ms. Amiri said the fetal heartbeat bill would effectively eliminate abortion in Kentucky. About 90 percent of abortions in the state are performed after six weeks, according to the lawsuit. The law would make an exception for procedures that were necessary to prevent death or serious risk to the woman.

She said Judge Hale’s ruling came as a “tremendous relief.”

“The clinic sees patients today, and before we got the ruling yesterday, they were in the process of canceling appointments,” Ms. Amiri said on Saturday. “It means they will be able to provide care today and that is incredibly important to every person who comes to the clinic.”