Because Tom is black and Mayella is white, it would have been insulting for Tom to say he felt sorry for her. Even though the Ewell family lived in extreme poverty, they were still considered higher than blacks in society. In the novel, the emphasis is placed by italics on the "you" and "her" of the quote stressing that if anyone was going to pity anyone it should be the other way around. Mr. Gilmer emphasizes this to the jury, and Scout says she can tell that the people 'down below' (in other words the white folks) don't like Tom's statement.
During this time in history it would be a big deal for a black man to feel sorry for a white woman. In Chapter 19, Mr. Gilmer asks Tom, "Why were you so anxious to do that woman's chores?" He continues to ask questions about this until Tom says, "Yes suh. I felt right sorry for her, she seemed to try more than the rest of 'em."
Gilmer immediately realized Tom's mistake (as did probably everybody in the courtroom) and emphasized what Tom had said. Gilmer said "You felt sorry for her, you felt sorry for her?" He then gave a dramatic pause to let this sink into the courtroom.
Gilmer really tried his best to get Tom to make this mistake. After asking the question about the chores above, he continued to ask questions to lead Tom to make the response he did.