At the beginning of the war, the main purpose that the North had was to preserve the Union. This was threatened due to the decision of the South to secede from the Union. This means that the war was mostly a reaction to the Confederacy, and it had one main purpose.
This, however, changed as the war progressed. The preservation of the Union remained an important objective, but slavery began to gain more prominence. This was particularly true once the North believed victory to be possible. The war changed from objecting the creation of the Confederacy to objecting the way of life in the South. Moreover, it became clear that as long as slavery continued to exist, it would be impossible to completely restore peace and unity to the nation. Therefore, in later years, the Civil War became a total war with the purpose of abolishing slavery.