It goes back to Buchanan. The president before Lincoln. In any case it was the South wanting to keep slaves.
I want to be clear that I believe slavery was an evil that should not have been allowed, however, that was not the primary reason for the war. As always, follow the money. There were disputes between the north and south about trade and tariffs, and that was the main reason for the war. Did you know that Lincoln did not free all slaves with the Emancipation Proclamation?