The Germany international had been tipped with a move away from Die Knappen since the off-season, with Bayern said to have been battling Manchester United for the playmaker's services.
And, the Bundesliga club have come out on top of their pursuit, with Schalke boss Christian Heidel confirming the deal.
He said: "We have noted this, with regret. Yesterday [Thursday], Karl-Heinz Rummenigge has informed us that Leon has passed the medical check. We're losing a very, very good player.
"He has signed a contract from the first of July 2018 with FC Bayern. We did everything possible to keep Leon at Schalke.
"In the summer, there was an agreement with him and his advisers. Still, he wanted time to wait for the sports development."