First of all, it is important to realize that we cannot know for sure what the exact nature of this connection is. There is no way to experiment and determine whether racism would exist if slavery had not existed. There is no way to go back in time and determine what levels of racism existed before slavery existed. Instead, we can only speculate. Historians who have studied the issue speculate that the connection between slavery and racism is complex. They argue that racism helped lead to slavery, but that slavery also helped cause racism.
It is believed that Europeans (or at least English people) had negative reactions to black Africans as soon as they met. The color black was associated with bad and the color white with good and these perceptions affected the ways in which the English perceived the Africans. The English were also put off by the differences between their cultures, religions, and other aspects of life. They saw the Africans as in some way inferior. Historians believe that this attitude helped allow the English to accept the idea that Africans could and should be enslaved for life and that their descendants should be enslaved as well.
However, it is also believed that, before slavery, racism was not as fully developed as it became. Slavery led to the promotion of various attitudes about Africans. It led to the idea that they were stupid and lazy, perhaps because slaves had no motivation to try to work hard and show initiative. It led to various other negative views about blacks, partly because whites needed to tell themselves such things to continue to justify slavery. In other words, the fact that blacks were enslaved for so long led to a deepening and hardening of racist attitudes about them.
In these ways, it is believed that racism helped bring slavery about and that slavery helped, in turn, to strengthen racism.