Badstuber has fallen out of favour under Ancelotti after suffering numerous injuries in the last four years.
It comes after Bayern coach Carlo Ancelotti ruled out a permanent move for the out-of-favour German international, 27, with ex-Bayern boss Pep Guardiola reportedly interested in teaming up with Badstuber again at City.
"Holger deserves to play. He’s been injured so often but now he’s physically fit again and would like to play more games," said Bayern chairman Karl-Heinz Rummenigge.
"That’s why he asked us to allow him to go out on loan to Schalke, and we gladly agreed. We hope Holger will get plenty of minutes under his belt in the coming months."
Badstuber, who will undergo a medical at Schalke in the next few days, said: "I’m thankful that FC Bayern have agreed to my request. I’d like to get some much-needed match practice at Schalke and I’m looking forward to my time in Gelsenkirchen."
Speaking earlier from Bayern's winter training camp in Doha, Ancelotti said that there was "no chance" that the defender would be sold and the German champions want to extend his contract when it expires at the end of the season.
"I said if he decided to leave because he wanted to play we can deal with it for six months," said the Italian.
Badstuber has fallen out of favour under Ancelotti after suffering numerous injuries in the last four years, including back-to-back knee injuries.
He has played just 28 minutes for the Bundesliga leaders since October.
He won the last of his 31 caps for Germany in March 2015, but is Bayern's fourth-choice centre-back behind Mats Hummels, Jerome Boateng, who is currently injured, and Javi Martinez.
"He is a very interesting player because he has international experience and is a Bayern Munich player, but I don't know if it is realistic," said Schalke coach Markus Weinzierl at their training camp in Benidorm, before news broke of Badstuber's move.
Schalke are 11th in the Bundesliga.
Bayern, who have been in Doha for one week, are set to return home to Germany on Wednesday after playing a friendly match against Qatari-owned Belgian league side KAS Eupen on Tuesday evening.