Southern states wanted the federal government to force northern states to return escaped slaves to the south.
The federal government sided with "state rights" and said the South had no control over the northern states, and the federal government couldn't force them either.
So the south started a civil war against state rights, and a couple years into it the Feds went ahead and outlawed slavery as an economic sanction against the South.
The cause wasn't as simple as "slavery" and it was pretty much the opposite of what modern day confederates pretend it was about