Europeans started to enslave Africans.
They started to use slaves instead of indentured servants, because the investment was better. Indentured servants only served for a few years, and then were granted freedom, while slaves were purchased and used for their entire lives. The investment of a slave was better than an indentured servant.
Because many people think different things about how they should others which is why sometimes it could be legal and other times it could be illegal.