The Union's goal entering the Civil War was not to abolish slavery. It was to get the Confederacy to secede and rejoin the Union. With this, the president at the time, Abraham Lincoln was a Free-Soiler, and his election was one of the contributors to the war. After the Mexican-American war, many leading army generals went to the side of the confederacy leaving the Union lacking in terms of military leadership. The abolition of slavery came as an afterthought to punish the confederacy from separating from the Union.
The Confederacy separated from the Union, and with it the centralized government that was holding the country together. This ultimately weakened the Confederacy because there was a lack of leadership, and political unity. This weakened not only their efforts to be their own country, but also their ability to fight during the Civil War. This lack of unity is likely what led to their ultimate loss.