General manager John Lynch said in a statement that Cooper will compete for a starting job with the 49ers.
"Having started 27 games in four NFL seasons, Jonathan brings great experience to the interior of our offensive line," Lynch said in the statement. "We look forward to him competing for a starting job at guard, while also bringing a veteran presence to our locker room. Jonathan is a welcome addition to our team."
Cooper started a career-high 13 games for the Dallas Cowboys in 2017, playing between Pro Bowl left tackle Tyron Smith and center Travis Frederick. He helped solidify the line after the Cowboys lost Ronald Leary to free agency last year to the Denver Broncos.
Cooper, 28, suffered a sprained medial collateral ligament in his knee during the season finale against the Philadelphia Eagles and had postseason surgery. The belief is he will be able to return to the field for organized team activities and the June minicamp.
Injuries and subpar play led to his demise with the Arizona Cardinals, who drafted him No. 7 overall in 2013. In 2016, Cooper was part of a trade to the New England Patriots that sent pass-rusher Chandler Jones to the Cardinals. Cooper made the Patriots' 53-man roster but was inactive for four games before he was released. The Cleveland Browns claimed Cooper, and he started three of the five games he played before he was cut by Cleveland.
He signed with the Cowboys during the bye week of the 2016 playoffs and was inactive for one game. He returned to Dallas on a one-year deal and took over a starting role one month into the season.
ESPN's Todd Archer contributed to this report.