In the years preceding the Civil War, slavery proved to be one of the most divisive issues in American politics. As abolitionist sentiments grew within the North, slavery became increasingly entrenched throughout the South. Slavery (and in particular its status within the territories) became the key political issue that defined the 1850s, and Abraham Lincoln's election to the presidency proved the impetus for Southern secession and, with it, the start of the Civil War.
As far as the Civil War itself is concerned, for the South, the defense of slavery was the critical issue (and the defining motivation behind secession to begin with). In the North, however, while it was certainly a key motivation, many Northerners were first and foremost motivated out of a desire to restore the Union. This is why the Emancipation Proclamation was such a significant symbolic act: it placed emancipation as a central motivating factor of the Civil War in a way it had not previously been, and this had the effect of transforming how the war was perceived and understood.
Finally, the Lost Cause narrative emerged after the Civil War and the end of slavery. Attempting to justify the Confederacy, it minimized slavery's role as a causal factor in the Civil War, instead arguing that the war was fought first and foremost for state's rights or the defense of a traditional way of life. While there was still a degree to which the Lost Cause narrative persisted in defending slave 0wners and slavery, its key tendency was to distance the Confederacy from slavery so that the one could be defended without necessitating support for the other.