Answer:
Mary Warren turns against John Proctor in court because she is scared of Abigail Williams and does not want to be hanged for confessing. She is also scared that Abigail Williams will turn on her. Abigail starts accusing Mary of sending her spirit to attack her. The only way for Mary Warren to escape this situation was to lie and blame Proctor for everything.