Schalke's director of sport, Horst Heldt, confirmed the news to SID, an AFP subsidiary, on Thursday.
Having quit as Hoffenheim coach in January, this will be Rangnick's second stint at Schalke, as he previously coached the Royal Blues between September 2004 and November 2005.
Magath was sacked on Wednesday with his side 10th in the league.
Rangnick will take over after Sunday's Bundesliga game at second-place Bayer Leverkusen, when caretaker coach Sepp Eichkorn will be in charge.
Having beaten Valencia 3-1 at home to reach the quarter-finals of the Champions League 10 days ago, Rangnick and Schalke will find out their last eight opponents when the draw is made by UEFA in Nyon, Switzerland, on Friday.
Rangnick stormed out on Hoffenheim at the start of the year after star midfielder Luiz Gustavo was sold to Bayern Munich by club owner Dietmar Hopp behind his back.