The founding fathers, looking to rid themselves of the shackles of tyranny, made a deal with the devil (the south) in order to strengthen their numbers & scope. They also wrote into the Constitution a way to keep the south from overpowering the union while allowing a distasteful sacrifice to continue until it could be forbidden. (the 3/5 Compromise)
However, many states took it upon themsleves to outlaw slavery. It was not always as it's been taught