Terms of the deal weren't disclosed.
Boller, who replaces Trent Green as the backup to Marc Bulger in St. Louis, spent six seasons in Baltimore. He missed all of last season after suffering a shoulder injury during the preseason.
Boller's best season came in 2004 when he started 16 games and totaled 2,559 passing yards with 13 touchdowns and 11 interceptions.
In St. Louis, Boller will be reunited with center Jason Brown, who left the Ravens two months ago to sign a five-year, $37.5 million contract with the Rams. Brown was Baltimore's starting center for the past three seasons.
The Associated Press contributed to this report.