The 49ers announced the one-year agreement Monday, but the team didn't provide financial terms of the deal.
Jefferson last played in the NFL for the Ravens, but he hasn't been on the field since suffering a torn ACL in the 2019 season. Baltimore released him in February 2020 and he remained unsigned for the 2020 campaign.
After the signing was revealed, Jefferson posted a photo of himself in a 49ers uniform on social media with the caption: "God is good let's work."
The 29-year-old Jefferson received $19 million guaranteed on a four-year pact with the Ravens in 2017, but the veteran defensive back failed to live up to the team's expectations. He totaled just two interceptions, two forced fumbles and 11 passes defensed over 35 games in Baltimore.
Jefferson spent his first four seasons with the Arizona Cardinals after going undrafted in the 2013 draft. In 98 career games between the Cardinals and Ravens, he has recorded 450 total tackles, 8 1/2 sacks, eight forced fumbles, three fumble recoveries, four picks and 22 pass breakups.
The 49ers released cornerback Briean Boddy-Calhoun in a corresponding roster move.