If added to the 40-man roster, the 29-year-old Dominican right-hander would receive a one-year contract at a rate of $625,000 while in the major leagues and $90,400 while in the minors.
Mejia will report to Boston's minor league spring training camp. He has been out of the majors since July 2015.
Mejia was suspended for life on Feb. 12, 2016, after his third positive test for a banned steroid. The drug agreement allowed him to apply a year later for reinstatement that would be effective a minimum of two years after the ban started, with the decision at the commissioner's discretion. Commissioner Rob Manfred gave him conditional reinstatement last July 6, and said Mejia could return to the big leagues in 2019.
"He has been reinstated by MLB, so we are hopeful he has learned from his past mistakes," Red Sox president of baseball operations Dave Dombrowski told the Boston Herald.
The New York Mets released Mejia on Nov. 20 rather than allow him to become eligible for salary arbitration. Mejia has four years, 140 days of major league service, and the Mets could have tried to cut his salary to $1,383,200 had he remained on the roster.
Mejia was the Mets' closer in 2014. He was suspended for 80 games on April 11, 2015, following a positive test for Stanozolol, a drug popular among bodybuilders. At the time, he maintained, "I can honestly say I have no idea how a banned substance ended up in my system."
Mejia returned on July 12, appeared in seven games for New York, then was banned for 162 games on July 28 after a positive test for Stanozolol and Boldenone. The third suspension was for a positive test for Boldenone, an anabolic steroid generally used by veterinarians on horses.
Mejia is 9-14 with a 3.68 ERA in 18 starts and 95 relief appearances. In addition to random drug tests, he is subject annually to six additional urine tests and three additional blood tests.
Information from The Associated Press was used in this report.