Many people erroneously believe that the Emancipation Proclamation ended slavery in the United States. In fact, the Emancipation Proclamation only freed slaves in areas that were in open rebellion to the the United States during the American Civil War (1861-1865). Abraham Lincoln's goal during the Civil War was to preserve the Union at any cost. Before issuing the proclamation Lincoln stated that if he could free all of the slaves and preserve the Union he would do that, and if he could free none of the slaves and preserve the Union he would do that, and if he could free some of the slaves and and leave others in bondage and save the Union he would do that too. Lincoln's writings bear out that he was against slavery, but saving the Union was of paramount importance.
Despite his personal feelings, Lincoln constitutionally didn't have the power to end slavery in the United States. The Emancipation Proclamation ended slavery in areas of the country in open rebellion because that would be a military action he could take as the Commander in Chief of the armed forces if they were regarded as war contraband. Freeing slaves in Confederate areas weakened the economy and even the military of the South (as some slaves served in the Confederate Army), and thus proved to be a strategic military action.
The Thirteenth Amendment to the United States Constitution after the Confederate surrender officially ended slavery and freed all slaves in the United States, regardless of their geographic location.