Foster joined Castleford for trials in 2017 after a proposed move to Bradford collapsed when the Bulls went into liquidation.
He went on to earn a two-year contract before signing a further extension in 2018 and helped the club reach both the Challenge Cup final and Super League Grand Final, as well as lift the League Leaders’ Shield in 2017.
Foster said: “Playing for this club has meant everything. From the moment I came here to now, it has been incredible.
“What I have accomplished in the time I have had here, I never thought I would.
“I thought I would never play Super League again after leaving Leeds in the early part of my career. The opportunity that this club has given me has been incredible.
“It has been one hell of a journey and I am so thankful to everyone involved, from the coaching staff to the fans, my team-mates as well who have made my time here what it has been for me.”
Castleford coach Daryl Powell, who is also leaving the club at the end of the season, said: “After coming in as a trialist Fozzy quickly embedded himself into the club.
“The way he is as a guy, he’s pretty softly spoken but you put him out on the field, and he is a warrior. It’s unfortunate he had injuries to deal with, but he is great.
“Fozzy’s adaptability and versatility are two of his biggest strengths, you put him in the middle and he is awesome, he can really bottle up a middle with his tough defensive work, but then you can put him in the centre or back-row – he will play pretty much anywhere, he is that kind of guy.
“We have built our club on good people, he absolutely 100% fits that, he’s been an absolute pleasure to coach.”