The Rays made the change about an hour before the first pitch; Longoria was initially listed at third base, batting fourth.
"Before the game, he was pretty ill," manager Joe Maddon said. "I did not want him out there dehydrated and pulling a muscle. That was not an option. He came down in the fifth inning and said he felt a lot better. It just did not work out for him to get in as a hitter."
Kelly Johnson played the first seven innings at third base and made an error on Brian Roberts' ground ball in the sixth.
Maddon is hopeful that Longoria will return to form on Monday.
"I think if he's able to eat a little bit and get a good night's rest, we should be fine, but I honestly don't know," he said. "We've had a little bit of a bug going around."
Longoria is batting just .130 with a .200 on-base percentage over his last five games, and he has just one homer over his last 26 games. He's hitting .263/.340/.485 with 29 homers and 77 RBIs on the season.
Adam Berry is a reporter for MLB.com. Follow him on Twitter at @adamdberry. Sam Strong is an associate reporter for MLB.com.