It’s impossible to know for sure. But since Tom was such a caring character, I think he did know of her situation. Tom would have helped Mayella regardless of her situation, but I get the indication that Tom felt it was even more imperative to help her because of her situation.
Perhaps he recognized that she was alone raising the Ewell kids with a father that was abusive and neglectful. Tom felt sympathy for her. Tragically and ironically, Tom’s generosity in helping Mayella only adds to the prosecution against him because the people of Maycomb actually see his help as inappropriate. Also, in their racist ignorance, Maycomb’s citizens can’t imagine that a black man would help a white girl without sinister intentions. Tom’s innocence and Maycomb’s hypocrisy and guilt are highlighted by this fact. Tom always had good intentions and the jury was never going to give him the benefit of the doubt or a fair trial.
I think Lee intended for the reader to think Tom knew about Mayella’s situation because it adds so much to these themes of racism, innocence and guilt.