The back-row, 28, has been at Wheldon Road for the last five seasons, scoring a try in the 2017 Grand Final loss against Leeds Rhinos having helped Castleford finish top for the first time in their history.
Out of contract, he has dropped down to the second-tier where he previously played for Featherstone Rovers and London Broncos but fully intends on helping to get Newcastle into Super League.
Foster, who played in the Challenge Cup final in July and can also operate at centre and loose forward, explained why he chose Thunder who will be a full-time squad in 2022.
“It’s down to the ambition of the club, the plan for the future and how this club is going to build over the next few years,” said the ex-Rhinos player.
“It is really exciting for myself.
"The prospect of getting this club up to Super League would be one of the best achievements of my career.
“There is a lot of excitement around here and I thought it was a great club and a great move for me at this point in my career.”
Newcastle head coach Eamon O’Carroll said: “I’m delighted to have signed Alex for the next two seasons.
“He is a great player and a great person and I am really looking forward to working with him.
“He’s going to add a load of experience and dynamism into our pack and I’m looking forward to seeing what he can achieve in our shirt.
“Alex is excited about joining and has fully bought into what we are striving to achieve and I can’t wait to get started with him and the rest of the squad.”