Chief Judge Mark L. Wolf ruled the surgery is the "only adequate treatment" for Michelle Kosilek's gender identity disorder, CNN reported.
Kosilek, previously known as Robert, was convicted of his wife's 1990 murder and has attempted to castrate and kill herself in the all-male Norfolk, Mass., prison, court records show.
"We are very happy with the ruling, of course. We are still reviewing the opinion and we anticipate the Department of Corrections will follow Judge Wolf's order and promptly arrange for Michelle Kosilek to receive her treatment," Kosilek's attorney Joseph Sulman said Tuesday.
"There is no less intrusive means to correct the prolonged violation of Kosilek's Eighth Amendment right to adequate medical care," Wolf's ruling states.
The American Society of Plastic Surgeons says operations, therapy, hormone injections and electrolysis associated with sex reassignment surgery can cost from $30,000 to $80,000.
U.S. Sen. Scott Brown, R-Mass., Tuesday called the decision "an outrageous abuse of taxpayer dollars."
"I look forward to common sense prevailing and the ruling being overturned," Brown said in a statement.
Wolf left it up to the Department of Correction to determine where Kosilek will be imprisoned after the surgery, CNN said.
Celebrity Couples of 2014 [PHOTOS]