Due to injuries, San Francisco 49ers rookie linebacker Reuben Foster has appeared in just two games this season. His first injury came during the first half of a Week 1 contest against the Carolina Panthers. Foster left the game with a high-ankle sprain and missed the team's next five games.

Foster returned to the football field for a Week 7 matchup against the Dallas Cowboys, left the game with a rib injury, and missed the team's next game. He was inactive against the Philadelphia Eagles on Sunday.

Foster has been practicing this week, and 49ers head coach Kyle Shanahan is very optimistic about his chances of playing on Sunday against the Arizona Cardinals.

Shanahan joined the "Murph & Mac" show on KNBR Friday morning and discussed Foster's progress.

"I expect Reuben to play," Shanahan said. "We thought he could last week too and then it ended up after we got off that plane ride he was just having back spasms and everything and really struggled to loosen up for that game. He's had a good week of practice. It's been much better. Hopefully, we have no setbacks here over the next 48 hours, but I expect him to play on Sunday."

The 49ers defense ranks near the bottom of the league in multiple categories. It is 31st in points allowed, 28th in yards allowed, 24th against the pass, and 29th against the run. Adding a healthy Foster to the lineup would be a big boost for a the defense, which has been without him for most of the season.

49ers defensive coordinator Robert Saleh said on Thursday that Foster has been unlucky during his rookie season.

"He's been very unlucky with the injuries that he's had," Saleh said. "He's definitely not injury-prone. That didn't even cross my mind. It's just been very unlucky and very unfortunate though, some of the things that have happened to him. Once he gets his body back, the improvement is just going to skyrocket. It's just a matter of getting him going."