A total of 23 children – some as young as eight – were among those rescued from the Whole Bible Believer Church in Ondo State.
Some people had been kept in the church since last year, according to local residents.
Pastors had encouraged church members “to stay behind” and wait for the rapture, a police spokeswoman said.
Rapture is the idea that Christian believers will be taken to heaven at the second coming of Christ.
One pastor had told church members it would take place in April and later claimed it had been changed to September, according to Ondo State Police.
A father, whose child was among the rescued, said he was denied access to his child and anyone who tried gaining entrance into the church was always attacked by the members.
Two pastors are in custody but investigators are yet to find evidence that the church members were forced to stay in the basement, the police spokeswoman said.
Nigeria is a deeply religious country where many religious leaders are revered. It is not the first time authorities have reported rescuing people held by clerics, whether voluntarily or by force.