At the outbreak of the Civil War, Lincoln declared that his main goal was the preservation of the Union and not the freedom of slaves. After the first few terrible years of the war, his views on the goals had changed.
Originally Lincoln has seen the send of slavery and the preservation of the Union as two different goals. He once said, “If I could preserve the Union and not free a single slave, I would do it. If I could preserve the Union and free them all, I would do that.”
By 1862, he realized that ending slavery would actually help him win the Civil War. First, it would deprive the south of European support. If the war were re-defined as a war against slavery, European nations could no longer support the south in good conscious. Also, slaves would be empowered to run away, rebel or maybe join the Union army. Lincoln’s abolitionist advisors expected that African Americans would sign up by the battalion if the wars goals were aimed towards freeing their fellow slaves in the south.
So Lincoln didn’t shift his beliefs so much, he just finally realized that both aims complimented each other and helped his ultimate goal.
At first, when the Civil War broke out in 1861, Lincoln wanted only to preserve the Union and bring the southern states that had seceded back into the Union. His premise at the outset of the war was that the Confederate states had no right to secede, that their actions were traitorous, and that the Union was justified in trying to bring the Confederacy back into the nation.
However, as the Union Army began fighting, Lincoln realized that the war would be difficult to win. It became necessary for him to provide a rationale grounded in democracy to motivate the Union troops and the North and to provide a broader context for fighting the war. In 1862, he signed the Emancipation Proclamation, which took effect in 1863 and freed the slaves in the Confederacy. Though this was largely a symbolic action, it signified Lincoln's eventual commitment to ending slavery and providing a more meaningful rationale for fighting the deadly and long Civil War.
In addition, Lincoln knew that by supporting the abolition of slavery, he would make it difficult for European powers such as England to support the Confederacy. This is because there was a strong abolitionist sentiment in England.