Lincoln issued the Emancipation Proclamation after Battle of Antietam. The Battle of Antietam was significant for the Union army, as it forced the Confederates to retreat from Maryland and prevented a Confederate victory on Union soil. After this win, Lincoln felt confident that the Union would be able to obtain victory.
The Emancipation Proclamation was supposed to free slaves in the "rebellious states" (aka the Confederacy). However, since the Confederate States considered themselves an independent nation with a new government, this law did not free any slaves. Despite this, the Emancipation Proclamation was important because it showed that a significant part of this war was about slavery and it allowed blacks who escaped the Confederacy to serve in the Union army.