Armed officers found the inmates when they raided a school in the Rigasa district of Kaduna.
All the inmates were found in chains and said they were beaten. There are 22 women among them.
Two Cameroonians and two people from Niger were among those rescued.
Last month police rescued more than 300 male students from a similar boarding school in the same neighbourhood.