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."
No Combine, No Cry: Bob Marley's Grandson Signs NFL Contract with Redskins
Insider Buzz: Several NFL Coaches 'Annoyed' Over Changes to Overtime
Giants DL Damon Attempts to Eat 72-oz Steak
Insider Buzz: Dolphins Expect Big Role for Rookie DE
Insider Buzz: Bills Expanding GM Search
Insider Buzz: Bengals Taking 'Serious Heat' for Mixon Pick
Winners and Losers of the 2017 NFL Draft
Winners and Losers of the 2017 NFL Draft Day 2
Insider Buzz: Jaguars May Not Use Option on Bortles
Grading the Trubisky Pick
Former Pitt RB Beat Cancer, Now Sets Sights on NFL
What Are the Hottest Match Ups of the 2017 NFL Season?
Insider Buzz: Several Teams Eyeing Brock If Domestic Violence Charges Dropped
What Changed for Tony Romo on Day 1 of NFL Free Agency?
What Will It Take for Tony Romo to Land in Denver?
Tony Romo Says Goodbye to Cowboys
Deal Alert: Grading Alshon Jeffery to Philadelphia Eagles Free Agent Signing
Deal Alert: Grading DeSean Jackson to Tampa Bay Buccaneers Free Agent Signing
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.