Kevin James has an interesting and timely post about the way he addresses the motivations of soldiers in his Civil War class in Charlottesville. Click over and read it.
Seriously. Go read it.
My quick takes:
Why did nonslaveholders join the Confederate Army?
A) Religious duty - We read the Reverend Wilson's Sermon on the Mutual Relations of Slaves and Masters to understand the theology of slavery. Even if I don't personally benefit from slavery, I will fight for my conception of God's will. George Fitzhugh spends a good deal of time in Cannibals All defending the religious and moral superiority of Southern civilization.
B) Haiti and Nat Turner - The fear of uncontrolled black men became pathological in the wake of Haiti's bloody independence and Nat Turner's butchery. I may not own slaves, but I don't want them freed because they'll murder my kids and rape my wife. This also explains the motivation of many Klan members in the postwar period. The need to preserve the peculiar institution was tied up together with protection of kith and kin - thus the prevalence of odes to the greatness of Southern "domestic institutions." Fear of slave rebellion ended any internal critique of slavery and ended any discussion - the Gag Rule and postal censorship meant that 20 year olds in Georgia had never been exposed to competing ideas. So B supports the hardening of A.
C) Roedigger's concept of the Wages of Whiteness - The Southern culture was very hierarchical. If slavery ended, there would no longer be a bright line between poor whites and freedmen. It's a sad fact of human nature that we can feel better about our poor position (and poor whites suffered economically under an economic system dominated by plantations) if we have someone below to spit upon. A good analogy would be Indian opposition to ending Apartheid in South Africa. It also partly explains why many Northerners working in the factories were pro-slavery: My life as an Irish immigrant in a textile mill sucks, but at least I'm not a slave..."
D) At the beginning of the war, a sense of adventure - young men often thrill at the beat of the drums. I don't think this has much explanatory power when it comes to why the shivering kid at Petersburg kept soldiering on, but it does get boys into uniform.
E) Later, rage at the invasion of their homeland. Much of the rage was probably also at the North's goal of upsetting society by freeing the slaves, but there is a stand-alone rage that comes from hearing that your house was burned to the ground.
F) The Cult of Masculinity - the perverting nature of slavery made it imperative for Southern men to have a "face," prepared to meet any threat or insult with violence. A military career was held in high esteem. There was a greater martial culture in the South than the North.
G) Brotherhood - Once they'd seen the elephant, I don't doubt that many men fought in order to save their blood brothers and to avoid being shamed in front of them. Keegan has some great work on the role of brotherhood in later wars, and it makes sense that the same dynamic would be at work in the Civil War as well. Some recent historians like Chandra Manning have argued that soldiers in the Civil War were much more ideological than their later counterparts, so I think we need to be careful how highly we rank this item.
Answering the question of why Union soldiers fought is much more complex. The north was much more vibrant ideologically and did not have the same unifying culture as the south.
A) Religion There is no doubt that many abolitionists joined the colors to accomplish their goals by force (See: Beecher's "War and Emancipation" sermon in which he is ecstatic about sodomizing the South with the "red hot iron" of war). It was a religious crusade to many.
B) Many 48ers joined up and their unit mottoes revealed an enlightenment (as opposed to religious) condemnation of slavery.
C) Lincoln's "Polking" at Fort Sumter fooled many Northerners into believing that it was a war to preserve the union and had nothing to do with slavery.
D) I don't doubt many Northerners joined out of a sense of adventure.
E) Many Irish immigrants joined up in order to achieve citizenship and as a job.
F) Many were forced to join when they were drafted.