Federer suffered the injury the day after his Australian Open semi-final defeat.
The 17-time grand slam winner has forecast he will return to action “soon” but has pulled out of playing commitments for the rest of February, which includes Dubai and Rotterdam tournaments.
Federer, 34, tore a meniscus last week, said a statement on his personal website, rogerfederer.com.
It occurred on Friday, following the previous day’s four-set defeat to Novak Djokovic at the last-four stage in Melbourne.
How Federer suffered the setback was not detailed in the short statement. and he is now aiming to be fit for the Masters 1000 events in Indian Wells and Miami in March.
Federer said: “I am so disappointed to have to miss Rotterdam and Dubai as they are two of my favourite tournaments on the ATP World Tour.
“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.”
Federer is a seven-time Dubai champion and has won the past two tournaments in the UAE city.