The 38-year-old Kratz hit .125 (4 for 32) in 15 games for San Francisco. He was designated for assignment on Tuesday.
The Giants acquired Kratz in a March 24 trade with Milwaukee for minor league infielder C.J. Hinojosa. He helped the Brewers make it to the NL Championship Series last year, batting .292 with three RBI in nine playoff games.
The Rays got Kratz and cash considerations from the Giants for a player to be named or cash considerations. The deal was announced on Thursday.
Kratz broke into the majors with Pittsburgh in 2010. He is a .208 hitter with 31 homers and 101 RBI in 310 career games.