At the time that the Declaration of Independence was written, slavery was legal in the colonies. So too, at the time that the Constitution to these United States was written and thereupon ratified by those States, slavery was a legal institution. That did not mean at that time, that the intent of the Founders of this great nation, was for slavery to exist forever, but rather slavery was considered to be an institution that would have to be dealt with at a later time, of which the United States Congress so did. In fact, the "Act to Prohibit the Importation of Slaves" was passed in 1807, with its implementation being January 1, 1808, of which, by virtue of eliminating the importation of slaves, the thought was that over time, slavery would, perhaps, die a natural death. It did not.
In fact, slavery continued to exist as an institution in the States, and the division between those that embraced slavery and those that did not, became to be clearly demarked inexorably between the Northern and Southern States. Upon Abraham Lincoln's election in 1860, and despite the fact that Lincoln had made it clear that he did not believe that he had the Constitutional power to eradicate slavery, the South, took it upon itself, to secede from this union of States, and thereupon wrote its own Constitution.
The Southern Constitution, unlike the United States Constitution, utilized the words Negro as well as slave and slavery, and that Southern Constitution made it clear, that unlike historical revisionists propagating the so-called "lost cause" of the South, that the real reason for the Southern rebellion is contained within the words of that Southern Constitution, in which that Constitution, so states, "No bill of attainder, ex post facto law, or law denying or impairing the right of property in negro slaves shall be passed." Additionally, it so states, "In all such territory the institution of negro slavery, as it now exists in the Confederate States, shall be recognized and protected be Congress and by the Territorial government." The Southern Constitution was written and ratified primarily as the official means to defend and to uphold the institution of slavery, and the rebellion of the Southern States was a rebellion to protect and uphold that institution of slavery.
So then, because slavery was the root cause of the rebellion, and that rebellion was subsequently put down by a great cost in the lives of the people of these United States, over four long, bitter, and bloody years, it became mandatory for these United States to see that the aftermath of the union becoming the United States once again, that slavery in any of its many forms and manifestations, would be eradicated completely from this nation, never to raise its ugly head, again. Unfortunately, despite important Constitution Amendments so passed, it did not.
Regrettably, slavery in the form of another name, did come back to the Southern States, and alas, rather than all people of all faiths and colors, being accorded the same respect and equal protection of the law, and provided with equal opportunity within this nation, as well as the enfranchisement of the vote for all people, this did not occur and was for decades upon decades, in many respects a dead letter, and still is, even today. Therefore, this nation needs to resolve to take the full measure to eradicate the last vestiges of this slavery, and further needs to make good to all those that have been historically oppressed and are still oppressed, and have been so oppressed, for way, way too long.