I think I read somewhere that Lincoln had stated he would do anything needed to keep the Union together.
Including finding a way to keep slavery going as an institution, if necessary.
Yes, he did. He was a well known abolitionist, which is why the moment he was elected the south started seceding.
But his primary purpose was to hold the union together, and he said he would allow slavery in the south to continue to its natural death. What he would not allow was its extension into future western states.
And, if you read the articles of secession of the various states, that was what the war was about. They knew that if they couldn't spread slavery into the new states, over time the institution would eventually die out in the south too.
So from the point of view of the north, it was a war to preserve the union. From the point of view of the south it was to preserve the institution of slavery, and for both north and south the prize was the American West. It was not a war over whether or not the south would retain slavery, as Lincoln had already granted that. It was a war over who would control the west.
The South overplayed its hand. Instead of petitioning the Southern-dominated United States Supreme Court for permission to secede from the Union, they decided to fire the first shot at Fort Sumter.
Lincoln could barely suppress a smile after that.