The Ravens did not disclose terms of the contract, but a source told ESPN NFL Insider Adam Schefter that Schaub agreed to a one-year deal worth $3 million.
Schaub, 33, was released by the Raiders on March 16 after one forgettable season in Oakland. He replaces Tyrod Taylor, who had backed up Joe Flacco for the past four seasons.
The Falcons, Titans and Jets also were reportedly interested in Schaub. This move gives the Ravens their most experienced insurance policy since they had Marc Bulger as their backup in 2010.
Schaub has struggled the past two seasons, getting benched in Houston in 2013 and getting beaten out by rookie Derek Carr in Oakland last season. He has had five interceptions returned for touchdowns in the past two years.
This followed a solid run of success for Schaub, who had four 4,000-yard passing seasons for the Houston Texans. He went to his second Pro Bowl in 2012.
The addition of Schaub upgrades the Ravens' backup spot. Keith Wenning, who spent his entire rookie season on the practice squad, will likely remain the No. 3 quarterback.
The backup quarterback position has never been a high priority for the Ravens. Flacco has started 112 straight regular-season games, which is the third-longest streak in the NFL behind Eli Manning and Philip Rivers.
Matt Schaub brings experience as Ravens backup
ESPN Ravens reporter Jamison Hensley discusses QB Matt Schaub's signing with the team.