"Manuel Neuer underwent a successful minor operation ... on Wednesday evening after sustaining an injury to his left foot in training," Bayern said in a statement.
The 31-year-old Germany keeper will be sidelined for Bayern's Bundesliga matches against Augsburg on Saturday and Hoffenheim next Tuesday.
Then comes the league clash with Borussia Dortmund on April 8, followed by the Champions League quarter-final against Real four days later.
Neuer hasn't played since March 19, having pulled out of Germany's 1-0 friendly win over England and a 4-1 World Cup qualifier victory over Azerbaijan with a calf injury.
Sven Ulreich will likely replace Neuer for the two upcoming Bundesliga games, the reserve goalkeeper having only donned the Bayern jersey once this season, in the club's surprise 3-2 defeat by Rostov in a Champions League pool game.