The 17-time Grand Slam champion said he needs “more extensive rehabilitation” if he wants to prolong his career.
Federer, 34, had knee surgery in February before missing May’s French Open with a back problem.
Federer said on his Facebook page he was “extremely disappointed” to not be representing Switzerland in Rio and it was “tough” to miss the rest of 2016.
“I am as motivated as ever and plan to put all my energy towards coming back strong, healthy and in shape to play attacking tennis in 2017,” he added.
Federer won doubles gold at Beijing in 2008, but has never won an Olympic singles title and lost to Britain’s Andy Murray in the final at London 2012.
Federer twice required treatment during a five-set semi-final defeat by Canada’s Milos Raonic at Wimbledon this month, but found a “silver lining” in his injury-troubled year.
“This experience has made me realise how lucky I have been throughout my career with very few injuries,” he said.
“The doctors advised that if I want to play on the ATP World Tour injury free for another few years, as I intend to do, I must give both my knee and body the proper time to fully recover.”Source : BBC.com