The San Francisco Chronicle reported Martz will replace Jim Hostler, who was fired last week after the 49ers matched a franchise low and finished last in the NFL with 219 points.
Martz was fired last week by Detroit after two seasons as the Lions' offensive coordinator. He takes over an offense that finished last in points and yards per game.
Martz was the offensive coordinator for the Rams in their Super Bowl-winning season of 1999. The Rams racked up 526 points that season, the fifth-most all-time.
Martz moved on to the head coaching job in 2000 and led the Rams to a Super Bowl appearance after the 2001 season. His final season as head coach in 2005 was cut short by 11 games due to a heart ailment.
Martz is San Francisco's sixth offensive coordinator in six years.
Rosie O'Donnell unveils nearly 50-pound weight loss
Putin thinks Obama would save him if he were drowning