In the final act, when John and Elizabeth are talking, she alludes to some possible issues that had prompted the affair. She says, "I have sins of my own to count. It needs a cold wife to prompt lechery", perhaps referring to the fact that she was a stern, unkind woman, who was not very loving to John. She admits that "I never knew how I should say my love. It were a cold house I kept." So, she was not very openly loving, and had a hard time expressing her love for John. This, in combination with the fact that she had been "a long time sick", might have driven John away from her into Abby's arms. It doesn't justify the act, but at least gives us a clue as to some of the reasons why it happened.
We can't leave out the Abby factor though. If nothing else, this play shows her fierce determination when getting something that she wants. She wants John so badly for herself that she shoves a needle into her own belly to set Elizabeth up. Who knows what sort of scheming she did in the actual household when she worked there, in order to tweak situations into her favor. All in all, the affair was highly unfortunate, and leads to some very disasterous situations.
Elizabeth Procter actually reveals the best information that we get about this question. John Proctor never explains why he does this other than revealing that he did once lust for Abigail and stating that his wife was sick. However, in the end of the play – Act 4 – when Elizabeth is asked to get John to confess, she does blame the entire affair on herself. She says, “It were a cold house I kept.” Basically, she is telling him that he should not blame himself for what he has done because she was a very cold, unloving person toward her husband; she seems to feel that she drove her husband away from her and toward the only other woman who lived in their home – Abigail.