Well the attacking side certainly didn't attack because they wanted to defeat slavery. I think the defenders were defending mostly because they were being attacked.
So why was the attacking side attacking? They were attempting to maintain control of that money flow the South Produced.
Confederates were "the attacking side" and they certainly did intend to defend slavery.
The Union in defending itself also advanced the cause of emancipation, abolition and full citizenship for African-Americans.
Regardless of how much you spin it otherwise, those remain facts of history.