Harper left the game before the bottom of the fourth inning, when Scott Kingery took over in right field. He last batted in the third inning, striking out for the second time.
"[The soreness] came on tonight," Phillies manager Joe Girardi said. "He came to us, smart. You don't want to make it worse. Got him out. Hopefully it's just day to day."
Harper wasn't the only Philadelphia player to depart early.
Realmuto left Tuesday's game against Washington after taking a foul ball off his left knee and felt ill with a fever Wednesday night. After not playing Thursday, he was the DH in Friday night's series opener with the Blue Jays.
Harper, 28, is off to a red-hot start in his third season with the Phillies, slashing .318/.449/.582 with seven home runs and 11 RBIs.
The Associated Press contributed to this report.