Mary Warren was inspired to confess, intitially, by the urgent pleas from her employers, Elizabeth and John Proctor. They convinced her that it was her duty to tell the truth. People would continue to be put to death in Salem unless Mary Warren exposed the lies of Abigail and the other girls.
Proctor convinces her that she must expose Abigail's lies to the court, which she agrees to do.
However, at the court Mary Warren fails to confess. She tries, but fails. Abigail demonstrates her power and essentially threatens to accuse Mary Warren of witchcraft.
When Abigail is confronted with Mary Warren's proclamation that the accusations are lies, she pretends that Mary Warren is sending a spirit to assault her. The other girls join in and the acting job is so well done that the court cannot doubt Abigail's claims.
If Abigail continues along this line, Mary Warren will be seen as a witch. If she is seen as a witch, she will be put to death like the other people convicted of witchcraft. Mary Warren recognizes this and abandons her attempt to tell the truth.