It should be noted that slavery as an institution existed throughout the world long before the American Revolution. As a result, those states whose laws did not ban slavery had the legality "grandfathered" in.
While there were those who wanted to ban slavery, the slave holding states refused to accept the constitution unless it were left legal.
The Constitution and Slavery
Many colonists, even slave holders, hated slavery. Jefferson called it
a “hideous blot” on America. George Washington, who owned hundreds of
slaves, denounced it as “repugnant.” James Mason, a Virginia slave
owner, condemned it as “evil.”
But even though many of them decried it, Southern colonists relied on
slavery. The Southern colonies were among the richest in America.
Their cash crops of tobacco, indigo, and rice depended on slave labor.
They weren’t going to give it up.
The Northern states wanted slaves to not count in the determination of how many Representatives a state could have in Congress and to ban the import of new slaves from outside the country. They expected that the slave trade would die off by itself (since they did not anticipate the invention of the cotton gin).
Only the Southern states had large numbers of slaves. Counting them as
part of the population would greatly increase the South’s political
power, but it would also mean paying higher taxes. This was a price
the Southern states were willing to pay. They argued in favor of
counting slaves. Northern states disagreed. The delegates compromised.
Each slave would count as three-fifths of a person.
Following this compromise, another controversy erupted: What should be
done about the slave trade, the importing of new slaves into the
United States? Ten states had already outlawed it. Many delegates
heatedly denounced it. But the three states that allowed it — Georgia
and the two Carolinas — threatened to leave the convention if the
trade were banned. A special committee worked out another compromise:
Congress would have the power to ban the slave trade, but not until
1800. The convention voted to extend the date to 1808.
This caused the inclusion of Article I Section 9
The first clause in this section prevents Congress from passing any
law that would restrict the importation of slaves into the United
States prior to 1808. Congress could however, levy a per capita duty
of up to ten dollars for each slave imported into the country. This
clause was further entrenched into the Constitution by Article V,
where it is explicitly shielded from constitutional amendment prior to
1808. On March 2, 1807, Congress approved legislation prohibiting the importation of slaves into the United States, which went into effect
January 1, 1808, the first day permitted by the Constitution.