In Katherine Paterson's novel, The Great Gilly Hopkins, I would assume the setting is important primarily because while living in Maryland, Gilly will be required to interact with "people of color." With all of the resentments Gilly has acquired in being bounced from one foster home to the next, she takes her frustrations out on the weak (like William Ernest, the other foster child in her home) and especially African-Americans. Her teacher, Miss Harris, and the Trotter's dear friend, a blind Mr. Randolf, suffer from Gilly's lack of tolerance.
This element of the story provides the reader with a clear sense of Gilly's frustration with her life. It is especially obvious when she arrives at the Trotter house. Gilly meets Maime Trotter and describes her (unkindly) as a "bale of blubber" and a "freak." With William Ernest (W.E.)...
She waited until Mrs. Trotter and Miss Ellis were talking, then gave little W.E. the most fearful face in all her repertory of scary looks, sort of a cross between Count Dracula and Godzilla.
By the time she gets into school, Gilly ends up making a racist card for Miss Harris, and later steals money from blind Mr. Randolph.
However, it is only by seeing this side of Gilly that the reader can begin to appreciate the changes Gilly goes through when she really begins to settle in at Maime Trotter's home. She begins to read to Mr. Randolph from the books in his library. Gilly also starts to cooperate with Miss Harris, which enables Gilly to excel in her studies. Gilly even comes to the place where she identifies Maime Trotter as her "mom," William as her "brother, and Mr. Randolph as her uncle. These changes are indicative of how far Gilly has come. Without Gilly's need to come to terms with the issue of race in her daily life at school and at home, we would never have been able to see how far she has come by the time she is forced to leave yet again.