Some Republicans joined Democrats in rejecting the measure, which would have restricted bathroom access. Rep. Zooey Zephyr, Montana's first openly transgender legislator, won a second term last month.
Zephyr was silenced and barred for chiding her Republican colleagues over legislation to restrict gender-affirming health care and for encouraging protesters.
Gov. Greg Gianforte signed the bill on Friday, a piece of legislation that exiled transgender lawmaker Zooey Zephyr told fellow lawmakers would leave "blood" on their hands.