Both Benjamin and Compton inked one-year deals, according to the team. The 49ers didn't disclose financial terms of the agreements.
Benjamin, who is entering his ninth season in the NFL, spent the past four years with the Los Angeles Chargers. He recorded six receptions for 30 yards in five games last season before being placed on injured reserve with a thigh injury.
The Cleveland Browns selected Benjamin in the fourth round of the 2012 NFL Draft out of Miami. He played four seasons in Cleveland before signing with the Chargers in free agency.
In 101 career games, Benjamin has notched 208 catches for 3,143 yards and 19 touchdowns. He has also returned 109 punts for 1,189 yards and four touchdowns on special teams.
Compton, who is also entering his ninth NFL season, appeared in 14 games (five starts) with the New York Jets in 2019. He is joining his sixth team in the last six seasons.
The Washington Redskins selected Compton in the sixth round of the 2012 draft out of South Dakota. He spent his first four seasons in Washington before one-year stints with the Atlanta Falcons, Chicago Bears, Minnesota Vikings and Jets.
Compton has played in 99 career games with 34 starts. He started a career-high 14 games with the Vikings in 2018.