The seven-time world champion retired at the end of 2006 but will drive at the European Grand Prix on 23 August.
Ferrari said the 40-year-old will stand in for as long as Massa is sidelined by the serious head injuries he sustained in Hungarian Grand Prix qualifying.
"For team loyalty reasons I can't ignore this unfortunate situation," said the former Ferrari driver.
His spokesman Sabine Kehm had told the BBC on Tuesday that although Schumacher - who was working as a consultant for Ferrari - was not willing to make a full-time return to F1, he would not rule out standing in for Massa.
And the German racing legend has now decided to come out of retirement and make a sensational return to the sport.
"It is true that the Formula 1 chapter has long been closed for me," added Schumacher, who won five world titles for Ferrari.
"The most important thing first: thank God, all news concerning Felipe is positive and I wish him all the best again.
"This afternoon I met with team principal Stefano Domenicali and Ferrari president Luca di Montezemolo and together we decided that I will prepare myself to take the place of Felipe. "As the competitor I am, I also very much look forward to facing this challenge."
Schumacher has not driven an F1 car since April 2008 and competed in the last of his 249 grands prix in October 2006. And the most successful F1 driver of all time now has slightly more than three weeks to prepare himself for the European Grand Prix in Valencia.
The ban on in-season testing means Schumacher will not be able to turn a wheel of the 2009 specification Ferrari before first practice on Friday 21 August.
|Your name: *|
|Your email: *|
|Recepient's email: *|
|Enter code: *|