The 49ers announced the deal Friday.
Foster was projected by many to be a top-10 selection after an impressive college career, winning the Butkus Award as the top linebacker in the country at Alabama.
However, he slid on draft day toward the end of the first round before the 49ers nabbed him.
The injury wasn't enough to scare off San Francisco.
"The worst-case scenario, he wouldn't end up being able to play for us right away," head coach Kyle Shanahan told KNBR (via Kevin Spain of USA Today). "But I still don't think that would have changed how I personally felt about taking a guy with the 31st pick with the caliber of player that we took."
Kamara Is Taking on All Comers in Paintball
There's No Offseason for NFL Workout Warriors
Norman Goes on Shopping Spree for Detained Families
Hue Jackson 'Cleansed' Cleveland with Lake Erie Plunge
'Last Chance U 'Star Getting His NFL Shot
Is 44-Year-Old T.O. Working Out for a Comeback?
Eagles Drafted a 6'8", 346-Lb Rugby Player 😳
Happy 4-Year Anniversary to the 2014 NFL WR Class
One-Handed LB Might Be Draft's Biggest Badass
Mayfield's Journey to the Draft Ends Thursday
Ball Fam Has Nothing on the St. Browns 😏
NFL Stars Spending Their Offseasons Giving Back
Derrius Guice Runs from Difficult Upbringing
Harold Landry Is Draft's Best Pure Pass-Rusher
Which Teams Are the Best Fit for Dez?
Johnny Football Is BACK!
Quavo's Mega-Celebrity Flag Football Game
Meet the NFL's Next Alshon Jeffery
Tremaine Edmunds Is NFL Draft No-Brainer
Grading the Rams' Deal with Suh
Along with No. 3 pick Solomon Thomas out of Stanford, general manager John Lynch said the team grabbed two of the team's top three players on their draft board in the first round, per Jeff Darlington of ESPN.
Foster's health remains a question mark, but the 49ers are confident the young prospect will be an impact player on the defense as soon as he is ready to play. With contract issues now behind him, he will simply need to focus on returning to the field.
After a 2-14 season where they allowed the most points in football, San Francisco should be thrilled to add some much-needed talent on the defensive side of the ball.