Neither side was entirely clear, even unto themselves, with respect to the motivation for armed conflict. I would quickly add, none of this is particularly debatable.
South Carolina's secession, which was driven by the notion of state sovereignty and the state's associated independent rights, was indeed inherent to the debate over the future of slavery. But slavery as an institution, had little to do with the reason men chose to volunteer and take up arms.
In the North, the cascading number of states seeking to secede generated, at least in the first couple of years of the conflict, a very real patriotic desire to preserve the union at any cost. The end of slavery was well down the priority list and the purview of the abolitionists. We have only to turn to Lincoln's own words on the issue in August of 1862. "My paramount object in this struggle is to save the Union, and is not either to save or to destroy slavery. If I could save the Union without freeing any slave I would do it, and if I could save it by freeing all the slaves I would do it; and if I could save it by freeing some and leaving others alone I would also do that."
In the South, the reason for taking up arms was also unburdened with political nuance. McPherson's Pulitzer prize winning "Battle Cry of Freedom" quotes an unnamed confederate rifleman captured in 1862 or 63 who replied to why he was fighting when he owned no slaves. "I'm fighting because you're down here."
In an age where every issue and event in history is viewed through the ignorant prism of "presentism," we have difficulty conceiving of an era where patriots felt every bit as much loyalty to their state as to the nation as a whole. Lee's words following being offered the command of the Union Armies is a perfect example. "I look upon secession as anarchy. If I owned the four million slaves of the South, I would sacrifice them all for the Union, but how can I draw my sword upon Virginia, my native state."
We can trace the date that ending slavery did become a major goal of the war to a very specific series of events. Due to both economic and hemispheric policy reasons, both Great Britain and France were debating recognition of the Confederacy. It is important to remember that any negotiated end to the war meant a Southern victory of some sort. British recognition in particular would have meant breaking the blockade of Southern ports if not actual British involvement assuring a conclusion other than total Union victory.
As a result, Lincoln drafted the Emancipation Proclamation and presented to his cabinet in July 1862. The cabinet advised him to withhold release until after a Union victory so it would not seem an act of desperation. The battle of Sharpsburg (Antietam), a tactical draw but strategic victory in September of 62 provided the opportunity. The proclamation carefully only addressed slaves in the secessionist states, but inevitably made the end of slavery a goal of the conflict.
Most importantly to Lincoln, the proclamation made it impossible for either Great Britain or France to formally come to the Confederacy's aid or offer recognition.