The Massachusetts Senate unanimously passed legislation Thursday mandating protections for pregnant workers, an effort that came up short on Beacon Hill last session but now appears poised to become law.

The Senate passed the so-called Pregnant Workers Fairness Act filed by Sen. Joan Lovely by a 38-0 vote after about half an hour of debate.

“This legislation represents a shared commitment by both workers and businesses to support equal opportunities for pregnant women in the workplace,” Lovely said in her introduction of the bill on the Senate floor. She added, “Pregnant women who need income but are not granted accommodations are often forced to continue working in hazardous conditions, risking their own health and the health of their pregnancy. By ensuring reasonable accommodations for pregnant workers, we can help keep these women in their jobs and earning a paycheck, providing stability for countless families across the commonwealth.”

Lovely said three-quarters of women in America will become pregnant at some point during their working lives, and in Massachusetts, more than half of all pregnant women and new mothers are in the workforce.

The bill offers pregnant women reasonable accommodations, including “more frequent or longer paid or unpaid breaks, time off to recover from childbirth with or without pay, acquisition or modification of equipment, seating, temporary transfer to a less strenuous or hazardous position, job restructuring, light duty, break time and private non-bathroom space for expressing breast milk, assistance with manual labor, or modified work schedules.” The accommodations come with a caveat as the bill requires them as long as they “would not impose undue hardship on the employer.”

It also prohibits employers from refusing to hire a pregnant woman solely because she requires a reasonable accommodation. Employers would not be permitted to force pregnant employees to accept an accommodation that she does not want or to take leave if another reasonable accommodation could be provided.

There appears to be very little in the way of the Pregnant Workers Fairness Act becoming law in Massachusetts. A similar bill cleared the House unanimously in May and Gov. Charlie Baker, who is sometimes reluctant to discuss pending legislation, indicated he would sign the legislation if it reaches his desk.

According to MotherWoman, an advocacy group that has led the lobbying charge to enshrine these protections into law, 21 other states and the District of Columbia have taken legislative action to make sure employers provide accommodations for pregnant workers.

The bill passed Thursday by the Senate and the bill that cleared the House last month are similar, but they do differ in some places. It is not yet clear whether the two bills will go to a conference committee to be reconciled.