The bodies were found in the Ngabe-Bugle region. It is controlled by the religious sect called the New Light of God, the BBC reported on Friday, adding that 15 people were also freed from captivity.
Prosecutors announced on Thursday that they were investigating the case, adding that 10 people have been arrested on suspicion of murder.
Senior prosecutor Rafael Baloyes said the grave was discovered after locals alerted authorities last week about several families being held against their will by an indigenous-run church.
"They were performing a ritual inside the structure. In that ritual, there were people being held against their will, being mistreated. All of these rites were aimed at killing them, if they did not repent their sins," the BBC quoted the prosecutor as saying.
The victims included a pregnant woman and five of her children, while the 15 freed people suffered bodily injuries, a police official confirmed.
Exorcism is a religious or spiritual ritual carried out to supposedly cure people of demonic possession.
In 2018, around 250 priests from 50 countries attended the Vatican's annual exorcism course due to increasing demand among some of the world's Catholic communities.
In the Catholic Church, exorcisms are performed by trained priests who recite prayers and excerpts from the Bible intended to drive out demonic entities.
( With inputs from IANS )