Cersei was arrested for her Sins
Cersei was arrested by the Sparrows for his sins which include Incest and adultery.
Lancel Lannister told her secrets
Lancel Lannister became a devoted sparrow. He told the Sparrows about Cersei’s relationship with Jaime and her past relationship with him.
The Sparrows were empowered
The Sparrows were empowered, given weapons and allowed to take people prisoners if they had faith problems. Cersei was the one who empowered them yet they threw her in jail.
The Sparrows don’t recognize authority
The Sparrows don’t recognize any authority. To them all people are considered equal in front of God.
King Tommen didn’t want to shed blood
King Tommen didn’t want his men to attack the Sparrows. So both Cersei and Margaery remained in jail for sometime.
Kevan Lannister didn’t want to meet Cersei
Kevan Lannister Knew that Cersei is in jail but didn’t want to visit her.
Cersei refused to confess
Cersei was given the option on daily basis to confess for her sins and get released. Cersei refused to confess. (See Game of Thrones: Why Cersei hates Tyrion?)
King Tommen got depressed and isolated
King Tommen got depressed and isolated. He didn’t know what to do and he remained in his room. This allowed the Sparrows to keep Cersei jailed.
Cersei had no real friends outside
Because of the way she used to deal with people Cersei had few friends outside who were willing to save her from prison. (See Game of Thrones Season 3 Summary)