Dems and Repubs switched parties some time after slavery was abolished. So it was the modern day Repubs that fought to keep slavery. Also the confederacy was mainly started to keep slaves in the south so that rich families had free labor (poor families couldn’t afford slaves)