When the Republican Party was in its formative stage, it had a little problem. It took most of its members from the disintegrating Whig Party, and most of the rest from northern anti-slavery Democrats. But it needed a bigger piece of the pie if it wanted to have a shot at winning the presidency. That meant that they needed to win over members of the Know-Nothing Party (officially known as the American Party). This unsavory group of people were totally unglued by immigration from Ireland and southern Europe because they were Catholic, and also because they were low-skilled and often non-conversant in English. You might call them the 19th-Century version of the Tea Party. Ironically, however, at least in the North, they were not any more likely to approve of slavery than the average citizen. It was possible to win them over to the cause of preventing the expansion of slavery, or even abolition. After all, slave labor is an even worse competitor than immigrant labor because it is cheaper.
The great early leaders of the Republican Party, like William Seward, Salmon Chase, and Abraham Lincoln, didn’t share the anti-Catholic sentiments of the Know-Nothings, but they needed their support both for the new party and for their strength within it. When Salmon Chase ran successfully for Governor of Ohio in 1855, he didn’t support any part of the Know-Nothing program, but he made sure that Know-Nothings were on the GOP ballot for most of the statewide offices.
In any case, the Republican Party has morphed in many ways since the Civil War. It now resembles nothing more than the Democratic Party of the 1850’s, while the Democratic Party is more like a hybrid of the Whigs and the northern Democrats of that time. But the Know-Nothings have stayed in the GOP to this day. They are kind of the Original Sin of the Republican Party.