Slavery was a critical cause of the Civil War. The South was completely convinced that Lincoln would end slavery. They viewed the events of the late 1850s and early 1860s as evidence that northerners wanted slavery to end. A good example of this was the North's reaction to John Brown's execution. Thus, the preservation of slavery was an important cause in the mind of Southerners.
However, if one examines Lincoln's own words, it is fair to say ending slavery was not the main goal of the North at the start of the Civil War. Lincoln said if he could keep the country united, he would, even if it meant maintaining slavery where is already existed. For Lincoln, keeping the country united was the main focus. Lincoln's position on the slavery issue was to prevent slavery from spreading. Southerners interpreted this to mean ending slavery, but it wasn't what Lincoln was proposing to do at the start of the Civil War. As the Civil War progressed, ending slavery became more of a goal for the North, but at the start of the war, it clearly wasn't the main motivation.
Slavery was also involved in social, political, and economic factors which led to the start of the war. Southerners couldn't imagine a society where slaves would be equal to whites. They believed their entire economic system would collapse if slavery ended. They were concerned about the political power they had (and what would happen to it) if slavery ended.
Thus, there were many factors leading to the Civil War. Slavery was one of them, but not the only factor.
In recent times, with the controversy over the Confederate battle flag, this question has become rather controversial and different people might give different answers to it. My own view is that slavery was a major cause of the war for the Confederacy but not a major cause of the war for the Union. That is, the South was generally motivated by the desire to preserve slavery but the North was not generally motivated by the desire to abolish it.
The South seceded from the Union largely because it felt that the institution of slavery was no longer safe in the United States. To see how this is so, look at the following link, where you can find South Carolina’s declaration of the factors that led it to secede. That document mentions slavery on numerous occasions and complains of the fact that Abraham Lincoln, “whose opinions and purposes are hostile to slavery,” had been elected president. The South felt that their states’ rights were being infringed upon, but the only right they feared being deprived of was the right to hold slaves.” In short, then, the South seceded largely because it wanted to preserve the slave system and felt secession was necessary to accomplish this.
By contrast, the North was not bent on abolishing slavery. Instead, Northerners were more interested in confining slavery to the South and in keeping the Union together. The North was certainly opposed to the spread of slavery, and this brought it into political conflict with the South in a number of instances. These conflicts helped bring about the war. However, the main goal of the North going into the war was not to end slavery. President Lincoln famously said in a letter to Horace Greeley that his goal was to save the Union and that he would be willing to free all of the slaves, some of the slaves, or none of the slaves in order to achieve that goal. Clearly, the North did not go to war to end slavery.
My view, then, is that slavery helped cause the Civil War by driving a wedge between the two regions. Furthermore, it was a major cause of the war for the South since the South seceded to preserve slavery. However, the North did not go to war because of slavery but rather out of a desire to preserve the Union.