New York would gain flexibility if Alex Rodriguez is suspended for most of the season, relieving the team of a large percentage of his $25 million salary.
An All-Star in 2005 and 2007, the 36-year-old Roberts had spent his entire 13-year major league career with Baltimore. He has not played a full season since 2009 because of injuries.
Roberts is among the options at second base to replace Robinson Cano, who left the Yankees for a $240 million, 10-year contract with Seattle. Kelly Johnson, signed to a $3 million deal, is another possibility.
Roberts signed a $48 million, five-year contract before the 2009 season, then hit .283 with 16 homers, 79 RBIs and a big league-high 56 doubles.
His injury problems started the following year, when he missed most of spring training with a herniated disk in his back, then strained an abdominal muscle in the fourth game of the season while stealing second base against Toronto on April 9.
Roberts came down with pneumonia and didn't return until July 23. Then he missed the final six games of the season after sustaining a concussion when he knocked himself on the batting helmet with his bat after striking out in the ninth inning at Tampa Bay that Sept. 27.
Roberts had another concussion while sliding into first base against Boston on May 16, 2011, and didn't return until June 12 the following year. He appeared in just 17 games due season-ending hip surgery in August, and he had another operation for a sports hernia in December.
His total of 77 games last season was his highest in four years, and he hit .249 with eight homers and 39 RBIs.
He strained his right hamstring while stealing second base in Baltimore's third game of the season on April 4 and was sidelined until June 30.
Thornton, 37, replaces Boone Logan, who left for a $16.5 million, three-year contract with Colorado. A 10-year big league veteran, Thornton was 0-4 with a 3.74 ERA in 60 relief appearances this year for the Chicago White Sox and Boston, which acquired him in July for minor league outfielder Brandon Jacobs.
Thornton made $5.5 million in each of the last two seasons, and the Red Sox declined a $6 million option, which included a $1 million buyout. His agreement with the Yankees was first reported by the YES Network.