The 26-year-old failed a drugs test in the run-up to the 2017 Super League Grand Final when traces of the substance were detected in a urine sample.
The England international, who was dismissed by Castleford upon failing the drugs test, will not appeal against the suspension, which has been backdated to September.
"This was a truly exceptional case, where the drug use was never linked to performance enhancement," read a statement from Hardaker's legal team.
"In this regard, Zak would never take any substance to achieve an unfair advantage and we're pleased the decision has recognised this fact.
"The past two years have been an extremely difficult period for Zak who, away from the public eye, has bravely battled a number of personal traumas.
"He has asked for privacy, but thanked his family and close friends for helping him through this difficult period."
According to BBC Sport, Hardaker will be free to find a new club when his suspension ends on November 7.