In the recent time since Obama's election to the presidency, the sometimes racially-tinged atmosphere surrounding his critics has created an image of the stereotypical insane, racist and uneducated religious fanatic that invests all their beliefs in the extreme right. This image has impregnated itself into the rhetoric that is used in the frequently volatile debate that takes place between conservatives and liberals. As such, a frequent retort is stating that the Democratic party, currently the party of liberals, supported slavery while Republicans sought to end it. The problem is, this implicates that these parties have remained static since the time of their founding. This simply is not true.
It is true that the Democratic party had a stronghold in the deeply conservative South for the majority of its existence. What is not true is that the party's composition is the same as it was 150 years ago. Despite the highly racist viewpoints of most southern individuals, the southern Democrats had extremely right-wing leanings regarding governmental power and personal liberty - so much that when Lincoln was elected to office, the perception that he could use governmental power to force the end of slavery prompted Virginia, then ten others, to secede from the Union, following setbacks and conflicts in new territories and laws (see Bleeding Kansas - this is often credited as the event that resulted in the formation of the "new" Republican party) and the fear that the rights of the states would be infringed upon and ultimately destroyed. At this point in time, the Republican party was still as a whole liberally-slanted, primarily on it's advocation of abolitionism.
During the short-lived Confederate States of America, Jefferson Davis presided as president over the newly-seceded states. But given the fear of government dominion and the hysteria over state's rights versus federal power, the central government ended up being very weak, to the point that it could not enact taxes and drafts without the approval of the states themselves, and is often cited as one of the reasons for the downfall of the Confederacy. These [small government, low taxes] are among the core tenets of American conservatism, universally recognized both informally and formally.
So when did the parties reverse their stances? No one event in history can explain it. The beginning is sometimes seen during the Prohibition and Progressive era, when the deeply conservative Religious Right's vehement opposition to alcohol drove some of the more socially liberal and progressive demographics to the Democratic party. Another more plausible notion is that the highly Progressive views of Democratic incumbent Franklin Delano Roosevelt helped to solidify the predominantly liberal stance that is currently the hallmark of the Democratic party. Progressivism, while not a strictly liberal stance (both Democrats and Republicans had their progressives), the populist stance in regard to business and liberty appealed to the further left-wing segment of the nation, in particular the Socialists.
But despite all this, the South continued to remain Democratic for one sole reason: the support of segregation by their Dixiecratic politicians. As such, the event that resulted in the mass exodus of the racist, ultra-conservative southerners to the Republican party was Lyndon B. Johnson's signing of the Civil Rights Act, for reasons related to both his own political interests, but also because he felt that the Constitution guaranteed equal rights and liberty to all, yet the de jure segregation in effect from the long-standing Jim Crow laws went contrary to that doctrine.
Lyndon is having quoted as having "lost the South for a generation" because of his actions. Because the Republican party was already filled with the staunchly conservative religious groups, the southern conservatives were welcomed with open arms despite their racial leanings. Afterwords, the adoption of the politically-motivated and blatantly racist Southern Strategy by the Nixonian administration, the rise of the more radical New Left, and the election of Ronald Reagan helped to finalize the switch between the two parties. The rift between the younger liberal base and the conservative old guard only helped to accentuate the difference, especially in regard to the socially liberal stance of the rising New Left in contrast to the more religious and conservative viewpoints and attitudes that had dominated the American lifestyle for nearly two hundred years, also known to some as "family values".