The Maple Leafs play their regular-season finale against the Columbus Blue Jackets on Sunday and will then compete in the Stanley Cup Playoffs.
Penguins forward Tom Sestito hit Andersen in the head with his backside as he was skating near the crease 2:01 into the period. Sestito was penalized for goaltender interference.
Andersen was replaced by Curtis McElhinney with the game tied 1-1. Toronto, which trailed 3-2 in the third period, clinched a berth in the Stanley Cup Playoffs with the win.
"[Frederik has] been a leader, and I don't think you ever want to see him get hurt in a situation like that," McElhinney said. "At the same point, it's something that, as far as backup goalies go, you dream about it. It was a great opportunity."
McElhinney made 12 saves, including one on Sidney Crosby in the final minute with Toronto leading 4-3.
"I thought [Curtis] had to make some big saves there at the end," Babcock said. "He wasn't called on to make a ton, but he was called on to make big ones, and sometimes that's tougher. In a big game, that's important to our players and our team and our city as well."
The playoffs begin Wednesday.