The setting of To Kill a Mockingbird is important for a number of reasons that lend a certain truth to her work of fiction.
For one thing, the narrative is semi-autobiographical since Harper Lee herself grew up in the Deep South during the 1930's, and her character Scout is much like Lee herself. Also, Atticus is modeled after her liberal-minded father, who went against many in the Jim Crow South. Further, the trial of Tom Robinson could only have occurred and had the results it did when there were all white jurymen and when segregation was enforced and people's attitudes were often formed through bias.
In actuality, the trial of Tom Robinson is modeled after the trial of the Scottsboro Boys in Alabama, nine African-American boys who were accused of raping two transient women. There were several cases regarding these nine boys, many of which were travesties of justice. Included in these cases were a lynch mob, other mobs that caused disruptions, frame-ups, and rushed trials. Therefore, Lee creates much verisimilitude by modeling her narrative after real incidents and real people in much the same setting at the ones against the Scottsboro Boys.