The judge also ordered the payment of N25 million each to Mr. El-Zakzaky and his wife, making N50 million by the SSS.
Last month, at least 10 people were killed and several injured when police opened fire in clashes with the IMN during a religious celebration.
Justice Gabriel Kolawole, delivering a joint judgment in the two rights enforcement suits filed by the two applicants, ordered that the government should provide a befitting accommodation for the applicants, their family members and followers who used to live with them before they were arrested.
In giving his ruling, the judge rejected the argument of the Department of State Services (DSS) which said it was holding El-Zakzaky for his own protection.
The counsel had argured that El-Zakzaky, Wife and children were in protective custody of the DSS and was for their safety.
In August an official Judicial commission of inquiry by the Kaduna state government into the massacre on 12-14 December 2015 accused General Officer commanding the Nigerian Army's 1st Division, Adeniyi Oyebade, of orchestrating the military operation outside the chain of command.
El-Zakzaky was arrested after the Shiitte group was involved in a bloody clash with the Army in Zaria.
He said, "We are Nigerians, we are here to demand the release of our leader, Sheik Ibrahim El-Zakzaky who the government says is in protective custody".
He said the decision of the government to hold the applicant for so long amounted to great danger.
It ordered that the Attorney General of the Federation and Minister of Justice, Abubakar Malami, SAN, should within 45 days, ensure the provision of a befitting accommodation for El-Zakzaky, whose house was demolished by Soldiers past year, in any part of his choice in Kaduna or the Northern region.
Security analysts have drawn parallels between IMN - a minority sect in the mainly Sunni Muslim north - with Boko Haram, the Sunni Muslim jihadist group whose insurgency began in 2009 after security forces killed hundreds of its members and its leader Mohammed Yusuf died in custody.