The ex-Featherstone Rovers prop, 28, also has an option of a further year.
He will follow his Batley coach to Belle Vue as John Kear is joining as Trinity’s director of rugby at the end of the season.
“I’m happy to have signed for Wakefield; it is a club with a lot of history and they have made big strides this season,” said Hirst, who hit the headlines last year when he became the first professional rugby league player to come out as gay.
“I already have a great relationship with John Kear, so it will be nice that we can continue that and I am looking forward to playing under Chris Chester.
“I’m also looking forward to playing in the Super League.
“It is something all players aspire to do and it is something that I have wanted to do as a kid.
“I cannot wait to get into pre season and start playing for Wakefield next season.”
Batley-born Hirst started out in the same Bradford Bulls academy side as England star Sam Burgess but never played a first-team game for the club and, instead, cut his teeth with Hunslet Hawks.
He also played for Dewsbury Rams and Featherstone before making a permanent move to Batley in 2014.
Trinity head coach, Chester admitted: “This is a great opportunity for Keegan; he is playing exceptionally well in the Championship.
“It will be a big step up but I am confident that he can play a big part in this club going forward.”
Hirst has helped unfancied Batley reach third in the Championship this season and secure a place in the Qualifiers.
Controversially, however, he was dropped for last Sunday’s opener at Super League Hull KR due to an “internal disciplinary” matter.
He will be back in their team for Sunday’s trip to London Broncos, though, and Wildcats chairman Michael Carter added: “I’ve seen Keegan play a number of times this year, and he has been outstanding on each occasion.
“Hopefully in a Super League environment he will kick on further and provide real competition for our prop position next year.”