The 39-year-old underwent two knee operations in 2020.
“I am greatly disappointed, as it has been an honor and highlight of my career each time I have represented Switzerland,” Federer wrote in a statement. “I have already begun rehabilitation in the hopes of returning to the tour later this summer.”
Federer, a 20-time grand slam champion, competed in each Olympics between 2000 and 2012, winning men’s doubles gold in Beijing in 2008 and men’s singles silver in London in 2012. He missed the 2016 Olympics due to a knee injury.
He most recently played at Wimbledon where he was knocked out of the tournament in the quarterfinals. He last won a grand slam tournament in January 2018 at the Australian Open.
Federer joins a growing list of players who are forgoing the chance for Olympic gold this summer for a variety of reasons.