In many respects, Big Sam represents how the Confederate viewed people of color towards the end of the Civil War. Desperate for anything in terms of soldiers to offset the massive losses being sustained, slaves were "drafted" to fight for the South, who began to fully grasp that they were losing and defeat was inevitable if they did not respond quickly. Slaves like Big Sam was their response. His presence in Atlanta also serves to help Scarlett fully understand how the world has changed from the start of the war to the end of it. The setting in which Scarlett could dismiss the Tarleton Boys with a "Fiddlee Dee" and be content with slaves singing about "quittin' time" on the plantations has now been supplanted with a new reality, where Scarlett must befriend those who might have been either beneath her or opposed to her in order to maintain viability.
he was sent to dig trenches for the war and after that he had nowhere to go but stay in Atlanta
Big Sam is a field hand owned by the O'Hara's. He is sent to Atlanta during the final days of Sherman's attack on the city to help the Confederate soldiers dig trenches as part of the defenses for the city. In the novel, he tells Scarlet that Mrs. O'Hara sent him to dig ditches for the white gentlemen to hide in. Big Sam's appearence reminds Scarlet of home, and sets the stage for her trip to Tara with Melanie, the baby, and Prissy.