Modern racism developed out of a need to organize colonial rule and then to organize and control large heterogeneous labor pools needed for industrialization.
colonial rule yes, but i would say more out of the slave trade than industrialization with sugar, tobacco and cotton being essential outputs of the colonies requiring massive indentured or enslaved populations
'heavens above, how awful it is to live outside the law - one is always expecting what one rightly deserves.'
petronius, the satyricon