The 31-year-old will go straight into the squad for the game against his former club at Glanford Park on Saturday.
The centre-back signs a one-and-a-half year deal keeping him at the club until the end of next season.
United have the worst defensive record in League One and have strengthened in the absence of injured trio Andy Butler, Nathan Stanton and Lee Ridley.
Foster brings a wealth of experience to the Iron backline after making over 130 appearances for Rovers.
He was club captain for Dave Penney's side, but the manager brought in Sheffield Wednesday centre-back Graeme Lee for £50,000 last week and Foster left the club by mutual consent.
He had made 24 appearances this season up until his departure, scoring once.
He helped Doncaster gain back-to-back promotions from the Conference to League One, becoming a popular figure at Belle Vue.
He also had a spell at Bristol Rovers beforehand and made over 200 appearances at the Memorial Ground between 1997 and 2001.