Justine, in Mary Shelley's novel Frankenstein, initially sates that she is innocent of the murder of William.
“God knows,” she said, “how entirely I am innocent."
Later, in the same chapter (eight), Victor states that Justine had changed her stand of innocence.
Justine had already confessed her guilt.
Horrified by this change, both Elizabeth and Victor go to visit Justine prior to her hanging. Elizabeth, shaken that Justine had confessed to the murder of William, feels as though she must hear Justine's explanation.
After asked by Elizabeth why she admitted to her guilt, Justine stated the following:
“I did confess; but I confessed a lie. I confessed, that I might obtain absolution; but now that falsehood lies heavier at my heart than all my other sins. The God of heaven forgive me"
Based upon her explanation, Justine confesses to the murder of William so that she could be forgiven, by God, for all of the sins she had committed in her life.
Justine's history is a bleak one. Hated by her mother, Justine had gone to live with the Frankensteins. After the deaths of all of her siblings, Justine returned to her mother's side. Upon her return, her mother began to blame Justine for the deaths of her children (Justine's siblings). One could readily assume that Justine felt great guilt (given her mother blamed her for such awful things). After her mother died, Justine could have blamed herself for that death as well.
In order to find forgiveness for her past, Justine felt it necessary to admit her guilt for William's murder. She believed that her confession would make righteous in God's eyes. Unfortunately, the lie made her feel even worse.
Essentially, Justine's confession was to bring her solitude regarding her past.