It actually had a lot to do with the Enlightenment, which is pretty ironic. During that period is where enlightenment thinkers like Kant constructed the concept of "race." Before then RACISM DID NOT EXIST. THERE WAS SO SUCH THING AS RACE. Kant actually believed blackness was a germ that started in your belly button a spread to the rest of the your body and was a disease.

But the basic idea was that, according to science at that time black people were NOT human. Kant actually insisted that black people were giant germs.

So when something like the Declaration of Indenpence was written for the freedom of all MEN, black people weren't even included because they werent human. Its pretty crazy, because they still teach a lot of these "Enlightened thinkers" but rarely talk about their insane theories on race or how our governments created laws based on these theories.