In Chapter 23 of To Kill a Mockingbird, Atticus explains why Bob Ewell spit in his face in town and told him he would get even with Atticus if it took him the rest of his life. When the children ask him why he was passive after Bob spat at him, Atticus explains,
I destroyed his last shred of credibility at that trial, if he had any to begin with. The man had to have some kind of comeback, his kind always does. So if spitting in my face and threatening me saved Mayella Ewell one extra beating, that's something I'll gladly take.
In the courtroom, Atticus has exposed Bob Ewell and Mayella both as liars. Obviously, from Mayella's hesitations and her fearful glances at her father while she testifies it is clear that she has been coerced by her father to state that Tom Robinson made the sexual advances to her rather than the other way around.
In the setting of Maycomb, Alabama, in the 1930s, it is taboo for a white woman to be with a black man, so Bob Ewell forces Mayella to lie. Clearly, he has beaten her for her scandalous behavior. For, even though the Ewells are white trash, in Ewell's mind, they are better than any n****. And, he does not want anyone to question this social level, Atticus implies in the statement cited above.