This is a great question. One of the most striking features of slavery in America is that both masters and slaves loved the Bible. In other words, they read Paul and words of Jesus just the same and they all pledged their allegiance to the God of the Bible.
At this point you might ask how all of this could take place. The answer is that people have a tendency to read literature (the Bible included) in a very selective way.
So, slaves read the Bible, for example, through the paradigm of the Exodus. God would deliver his people from slavery and overthrow the oppressors. This kind of reading can produce a revolutionary spirit and at times it did. So, religion could be the basis of revolt and give strength to endure.
For the masters, they could always point to passages in the Bible where there were masters and slaves as a part of society. Orlando Patterson, a great professor at Harvard University calls this the Pauline paradox. I will add a link to his main point.