Tampa Bay traded Douglas, 31, for a low draft choice in 2009 and a conditional draft choice in 2010.
The Ravens needed a lineman after losing defensive end Dwan Edwards for the season. Edwards, who has been struggling with a back injury, was put on injured reserve Tuesday.
Douglas entered the league with the Ravens as an undrafted player coming out of Howard University in 1999.
After spending the 2000 season in New Orleans, Douglas went back to Baltimore, where he played from 2001 to 2004. He joined former Ravens defensive coordinator Mike Nolan in San Francisco from 2005 to 2007 as a free agent.
Douglas started 47 of 48 games with the 49ers, and had 71 tackles last season.
The Buccaneers signed Douglas to a four-year, $10.1 million contract this offseason, but his playing time came into question when the team re-signed Kevin Carter.
The Bucs didn't take a cap hit in the trade to the Ravens because they gave Douglas a $1 million base salary and a $1.6 million roster bonus. The Ravens assume the $2.6 million obligation this season.
John Clayton is a senior NFL writer for ESPN.com.