There has been a gamble on Carlo Ancelotti to become the next Manchester United manager.
Ignacio Camacho has ended speculation over his future by signing a new contract at Malaga.
The full-back has been released from his contract at Ashton Gate, which had a year remaining, and will be registered with the Irn-Bru Third Division champions on September 1.
Foster previously spent the 2010/11 campaign on loan at Ibrox while contracted to Aberdeen.
A transfer embargo means the Light Blues must wait until September to register players, who must be free agents.
A statement on the club's website read: "Foster arguably gave his best performances for Rangers on the European stage as he featured both in the Champions League and the Europa League at right wing-back.
"In total, he made 24 appearances which he will now add to as the forthcoming Second Division campaign progresses."
The 27-year-old made 51 appearances for City.