The only "switch" that happened was that the Republicans went from wanting a big government, to wanting a small government....the opposite for the Democrats.
It's silly to think that, all of a sudden, on cue, (or over time) everyone stood up and switched seats...and ideologies. ..
It's just a ruse to somehow, make people believe that, all of a sudden, the party that was mostly responsible for slavery and went to war to keep it, was dong everything to stop it while the other party, who fought to free the slaves, suddenly became racist, liked the idea of oppressing the blacks in the country.
Many will argue that the Democrats want of a big government was to simply switch the plantation.