He had been handed a first-round bye in Rome and, after all of Wednesday's play was postponed due to heavy rain in the Italian capital, Federer had to play twice on Thursday.
Rafael Nadal of Spain returns the ball to Fernando Verdasco of Spain during their quarterfinal match at the Italian Open tennis tournament, in Rome, Friday, May 17, 2019.
He said, "I hurt a toe and leg for a couple of games after sliding".
Bertens, who won the Madrid Open last week, will face Marketa Vondrousova or Johanna Konta for a spot in the final.
"I woke up this morning and couldn't really move my thumb", Osaka said. "I am not 100 percent physically and, after consultation with my team, it was determined that I not play", Federer said.
Before this year Osaka had never made the last eight of any clay tournament, but has now also reached the semi-finals in Stuttgart and quarter-finals in Madrid as she warms up for the second Grand Slam of the season in Paris.
Osaka's win on Thursday guaranteed she will remain No. 1 going into the French Open. Rome has always been one of my favourite cities to visit, and I hope to be back next year. "Has been little bit hard to hold the body and the tennis level for every day".
I think she's very talented, an excellent player.
With nine days to go until the French Open begins at Roland Garros, it remains to be seen whether Federer's injury is serious enough to throw his participation there into doubt.
Japan's Kei Nishikori, the sixth seed, got past American Taylor Fritz 6-2, 6-4 and then Jan-Lennard Struff of Germany in three sets.
"I know what happened last week, and I [am] going to try to do it better tomorrow", Nadal said.
The world number 24, a French Open quarter-finalist past year, has not dropped a set so far on the red clay of the Foro Italico and next faces either the top-ranked Djokovic or compatriot Juan Martin del Potro.