Pushed into action by a Supreme Court ruling that overturned 50 years of legal precedent in the United States, the Legislature on Tuesday sent to Gov. Charlie Baker the second major abortion rights bill in less than two years, seeking to shield providers from legal actions brought by other states and expanding and clarifying a woman's right to an abortion after 24 weeks of pregnancy.

The compromise bill that cleared both the House and Senate also expands access to emergency contraception, strengthens insurance coverage requirements for abortion services and would require college campuses to develop plans to ensure access for its students to abortion medication.

House Ways and Means Chairman Aaron Michlewitz, who led the negotiations for his branch, said the final bill makes "abundantly clear where the commonwealth stands on the future of reproductive rights."

The House and Senate delivered the abortion rights bill to Baker just 32 days after the Supreme Court overturned Roe v. Wade, setting in motion a wave of new restrictions on abortions in more conservative states and leaving providers in Massachusetts worried about the potential for an influx of out-of-state patients.

The House passed the bill 137-16, with just five Democrats and 11 of 27 Republicans opposing the compromise legislation. The Senate accepted the final bill on a 39-1 vote, with Republican Sen. Ryan Fattman casting the dissenting vote.

The focus now shifts to Baker, who despite being a pro-choice Republican has expressed some uneasiness in the past with expanding access to later-in-pregnancy abortions. He vetoed the last abortion rights bill over his objection to lowering the age of consent to 16 and concerns with the language regarding abortions after 24 weeks to protect the physical and mental health of the patient.

The governor, however, put in place through executive order many of the legal shields proposed in the bill to protect providers from licensing and legal penalties for providing abortion care to patients from states where abortion is restricted.

Baker said Tuesday at an unrelated bill-signing ceremony that he had not yet read through the entire piece of legislation, including the section pertaining to later-term pregnancies, but he hoped to be able to support it.

"I have only read about half of it. But I'm hoping that we'll be able to have a ceremony for that one, too," Baker said.

The governor did not say how soon he might complete his review, but acknowledged the time sensitivities involved.

"We know how important this is not just to people in Massachusetts, but to women around the country. So we'll be pretty aggressive about reviewing it," Baker said.

While Baker could wait until after July 31 to act on the reproductive health bill, it's also possible given his support for many of the provisions in the bill that if he's unwilling to sign it he could choose to send it back with amendments quickly so that they could be considered before Sunday and before it becomes an all-or-nothing proposition.

Fearing the eventual Supreme Court ruling that came in June, pro-choice lawmakers acted in late 2020 to codify the right to an abortion in Massachusetts state law and expanded access for women after 24 weeks of pregnancy in cases of a diagnosed fatal fetal anomaly.

Senate President Karen Spilka, however, said the intent of that law "wasn't being followed by all the providers correctly," and some hospitals were using risk panels to overturn decisions made by doctors with their patients to terminate pregnancies after 24 weeks.

"I firmly believe with all my heart and soul that decision must stay in the hands of a physician and the pregnant person. It is such an intimate and critical decision that we cannot allow panels, risk panels or whatever, to overturn those decisions," Spilka said in an interview with WBUR.

The bill prohibits a medical review process from overriding a decision made by a patient with her treating physician to terminate a pregnancy after 24 weeks that falls within the qualifying criteria outlined by the legislation.

In addition to cases where an abortion is determined necessary to preserve the life or physical or mental health of the patient, abortions after 24 weeks would be allowed under the bill in cases of lethal fetal anomaly or a grave fetal diagnosis that "indicates that the fetus is incompatible with sustained life outside of the uterus without extraordinary medical interventions."

Michlewitz said this effort to clarify the existing law should prevent any situations where a woman who lives in Massachusetts would have to travel outside the state to seek abortion care.

"We are strengthening and protecting the relationship between a patient and her doctor and the difficult decision they will ultimately have to make," Michlewitz said, adding, "No patient should have to go out of state to receive the necessary services."

The House had originally proposed to add language to the existing law to cover "severe" fetal anomalies, but Spilka said Tuesday that the Senate considered that standard to be "totally unclear."

The conference committee, led by Michlewitz and Sen. Cindy Friedman, developed the language regarding "grave fetal diagnosis" as a compromise, and leaders are hopeful this will assuage any concerns that Baker might have had and convince him to sign the bill.

Friedman lamented that by ruling against a federal right to an abortion the Supreme Court opened the door to other states using laws passed by their Legislatures to try to reach into Massachusetts and restrict access to care for their residents.

"This is an egregious and direct attack on a state's ability to make their own laws and protect their own residents," Friedman said during floor remarks.

Sen. Becca Rausch said she was proud to support a bill that makes "significant, sorely needed advances" in access to reproductive health and gender-affirming care. "This is a huge win. A massive win. A necessary win," she said.

But the Needham Democrat said the compromise also left out Senate-backed provisions to ensure insurance coverage for miscarriage management and to regulate crisis pregnancy centers, which critics argue work to discourage women from seeking abortion.

Rausch also said the fight for reproductive health care rights in Massachusetts will not be over until there are no restrictions on a woman's right to choose an abortion, including what she described as an arbitrary age limit of 16 to get an abortion without a parent's consent and the still-existing limits on abortion after 24 weeks.

She held up Vermont as an example of a state where there are no time restrictions on a woman's ability to choose an abortion.

"We must grapple with the fact that we still have restrictions on our books," Rausch said.

The bill would prevent Massachusetts authorities from cooperating with out-of-state investigations into abortion care delivered legally in Massachusetts or penalizing a provider who has faced charges or discipline in another state based on the delivery of care that is considered legal here.

It would also mandate that health insurance plans cover abortions without co-pays, deductibles or co-insurance, permit any licensed pharmacist to dispense emergency contraceptives, and allow for abortion medications such as Plan B to be made available in vending machines.

"At this time in our country's history we know now more than ever how important it is for our state Legislature to step in when our federal government is falling short," Senate Majority Leader Cindy Creem said.

[Colin A. Young contributed reporting]