The 27-year-old had been linked with a move to Manchester City where he would have been reunited with former manager Pep Guardiola, but the German defender has ultimately decided to stay in Germany and join Schalke.
Badstuber has struggled with injuries in recent years and has played just 18 out of 135 Bundesliga games in the last four years.
The defender wanted to leave the Bavarian giants in order to play regularly and he thanked Bayern for allowing him to leave for Schalke.
"I'm thankful Bayern have complied with my request," he said.
"I'd like to get some much-needed match practice at Schalke and I'm looking forward to my time in Gelsenkirchen".