The Canadiens announced the deal Monday.
Sanford, 29, went 11-11-1 last season with a 2.69 goals against average for the Vancouver Canucks. He had one shutout in 35 regular-season games.
Sanford posted a 7-3-3 mark with a 1.73 GAA and two shutouts in 16 games with the AHL's Manitoba Moose.
In 108 career NHL regular-season games, Sanford is 37-37-16 with a 2.76 GAA during stints with Vancouver and St. Louis.
Sanford is the latest addition to the revamped Canadiens, who have traded for center Scott Gomez, and added forwards Michael Cammalleri and Brian Gionta, and defensemen Jaroslav Spacek and Hall Gill in free agency.