From History:
On September 22, 1862, President Abraham Lincoln issued the preliminary Emancipation Proclamation, which declared that as of January 1, 1863, all enslaved people in the states currently engaged in rebellion against the Union “shall be then, thenceforward, and forever free.” Lincoln didn’t actually free all of the approximately 4 million men, women and children held in slavery in the United States when he signed the formal Emancipation Proclamation the following January. The document applied only to enslaved people in the Confederacy, and not to those in the border states that remained loyal to the Union. But although it was presented chiefly as a military measure, the proclamation marked a crucial shift in Lincoln’s views on slavery. Emancipation would redefine the Civil War, turning it from a struggle to preserve the Union to one focused on ending slavery, and set a decisive course for how the nation would be reshaped after that historic conflict.
…Lincoln personally hated slavery, and considered it immoral. “If the negro is a man, why then my ancient faith teaches me that ‘all men are created equal;’ and that there can be no moral right in connection with one man’s making a slave of another,” he said in a now-famous speech in Peoria, Illinois, in 1854. But Lincoln didn’t believe the Constitution gave the federal government the power to abolish it in the states where it already existed, only to prevent its establishment to new western territories that would eventually become states.
More here.