“And the Confederacy fought to protect slavery.”
If the Confederacy was fighting for slavery, who was fighting against slavery?
Nobody specifically. The end of slavery was a fortunate offshoot of the war but never the reason why the Union was fighting.