The Swiss suffered a torn meniscus the day after his Australian Open semifinal defeat to Novak Djokovic last week, his agent Tony Godsick said Wednesday.
The 34-year-old has pulled out of World Tennis Tournament in Rotterdam
which starts on Feb 8 and the Dubai Championships at the end of the month.
"I am so disappointed to have to miss Rotterdam and Dubai as they are two of my favorite tournaments on the ATP World Tour," said Federer, who won a seventh Dubai title in 2015.
The 17-time Grand Slam champion has also scooped two Rotterdam trophies (2005 and 2012) among his 88 career titles
"While this is an unfortunate setback, I feel grateful that up until now I have remained mostly healthy throughout my career."
"My doctors have ensured me that the surgery was a success and with proper rehabilitation, I will be able to return to the tour soon."
A meniscus is a C-shaped piece of cartilage
that acts as a shock absorber between the thigh and shin bones.
Tears to the meniscus, of which there are two in each knee, are a common injury for athletes. In 2014, striker Luis Suarez bounced back from a meniscal surgery within four weeks to score for Uruguay against England at the World Cup in Brazil.
a specialist knee surgeon at London Orthopedic Clinic said recovery times can vary significantly.
"There's a big difference between a small meniscal tear and a large one. It also depends on how the patient applies themselves to their recovery," he said.
"For someone like Federer, who will have one-on-one physio and plenty of time to work hard, a return within a month is reasonable."
Once the swelling has subsided and the muscles are back to full strength, Curry said the patient is "good to go."
"[Federer's age] might put him at slightly more risk, but he's a consummate professional and is old enough to know that if he isn't ready, he'll just have to skip another tournament."