Alabama lawmakers overwhelmingly advanced legislation on Thursday that would shield doctors, clinics and hospitals offering in vitro fertilization treatment, clearing a major hurdle in their race to enshrine protections for reproductive medicine into law.

The scramble comes after a State Supreme Court ruling this month found that, under Alabama law, frozen embryos should be considered children, upending I.V.F. treatment across the state and leading multiple clinics to stop offering the treatments to avoid possible liability.

The Senate unanimously passed its version of the measure, while the House approved its bill on a 94-to-6 margin, with a few lawmakers abstaining. Final passage is expected in the coming days, and Gov. Kay Ivey, a Republican, has indicated that she will support such a proposal.

The quick pace of the legislation underscores how most Republicans in Alabama are anxious to show their constituents that they are not standing in the way of the many families who turn to I.V.F. as a way to have a child.

National Republicans — including former President Donald J. Trump, the front-runner for the party’s presidential nomination — have also been quick to emphasize their support for reproductive medicine, and encouraged Alabama lawmakers to act.

But the debate on Thursday also made clear that the State Supreme Court ruling has raised complex and uncomfortable questions for Republicans, who must reconcile a long-held belief that life begins at conception with the science of I.V.F. treatment.