The Germany defender, who had come back days ago from a three-week injury break, turned his right knee after a challenge with fellow Germany international Mario Goetze during the 1-1 draw with Borussia Dortmund on Saturday.
He had to be carried off the pitch on a stretcher and underwent more tests on Sunday.
"Badstuber will undergo surgery on Monday and after that will be out of action for about five months," Bayern said in a statement.
Bayern, who lead the Bundesliga table by eight points, have also qualified for the knockout stage of the Champions League.
They host Belarussian side BATE Borisov on Wednesday in their last Group F match as they try to finish top.