The 23-year-old had agreed to join Bradford after leaving the Broncos at the end of the 2016 season but he became a free agent when the Bulls went into liquidation and is keen to return to Betfred Super League with the Tigers.
Foster said: "I'm really excited about the opportunity. It was a no-brainer when I found out there was some interest. Castleford is a great club with a proud history. They have gone from strength to strength in the last few years."
Castleford coach Daryl Powell said: "Alex is a player I have always been impressed with, since his time at London when he played against us when London were last in Super League.
"With Larne Patrick and Oliver Holmes both still being injured I think we are looking a little bit skinny moving forward, especially towards the Easter period and so I thought it was a great opportunity to get Alex in."
The announcement comes 24 hours after Castleford signed former Hull KR second rower Kevin Larroyer and immediately sent him out on loan to Bradford.
Foster has already begun training with his new team-mates, although he is currently recovering from a groin injury.