To be clear, the Civil War was all about slavery. But the architects of the confederacy had no reason to fear losing title to their slaves. The Republican Party had no intention of freeing any. The Republican Party platform of 1860 did propose to close new territories to slavery. That frightened large scale slave owners. Why?
The law of supply and demand. A large part of their capital was invested in slaves. Their mortgages were secured by the value of enslaved people. They had relied for half a century on the resale prices of slaves to go up due to increased demand. Territories closed to expansion, decreased demand, lower resale prices, lower property valuations, could mean bankruptcy. It would have been just like the collapse of a housing bubble.
Over this prospect, they seceded, and prepared for war. Jefferson Davis said so in his first address to the confederate congress. He wrote that closing new territories to slavery would render property in slaves "so insecure as to be comparatively worthless, and thereby annihilating in effect property worth thousands of millions of dollars."
But the federal government did not go to war to end slavery. If President Lincoln had called for volunteers to free slaves, he wouldn't have had an army worth mentioning. He called for volunteers to preserve the union. Why would people fight for that? For one, farmers and factory owners in the midwest relied on selling their goods to an international market via the Mississippi River through New Orleans. That is why Thomas Jefferson bought Louisiana from France in 1803 -- to secure the mouth of the Mississippi.
As Senator Henry Clay of Kentucky warned in 1850, "NEVER will we who occupy the broad waters of the Mississippi and its tributaries consent that any foreign flag shall float upon the turrets of the Crescent City."
So the war was going to be "a white man's war," and it was going to be over preserving the union not freeing slaves. But, it proved to be impossible to preserve the union without ending slavery.
First, when some enslaved men showed up at Fortress Monroe and sought sanctuary from federal troops, their owners of record came to demand their return under the requirements of the Fugitive Slave Act. General Benjamin Butler, in command at the fort, recognized that returning any property to men fighting a war against the United States would be stupid. So he developed the legal doctrine that these men, as property, were "contraband of war."
Perhaps Robert E. Lee made an essential contribution. If George Brinton "We're not here to take your property" McClellan had marched into Richmond in 1862, the union would have been restored as it was, with slavery intact. Lee spent a little more than a year defeating McClellan (although narrowly turned back at Antietam), Pope, Burnside, Hooker. In June 1863, when Lee took the offensive for the last time, he was turned back at Gettysburg. By then, Lincon had issued the Emancipation Proclamation.
The president of the United States had no constitutional authority to free slaves in any state. But, the proclamation was a war measure. It applied only to slaves owned by persons in rebellion against the United States. Since the war was all about slavery -- even though neither government admitted it -- that meant most of the slaves in the United States. Lincoln may have desired to do this all along, but he played his cards very close to his chest.
The proclamation was justified as a war measure to remove four million enslaved people as an economic and military asset to the confederacy. Furthermore, enlistments for the army were down. Some of the most enthusiastic volunteers had been killed or severely wounded in the first two years of fighting. Enlisting nearly 200,000 men of African descent to replenish the ranks of the army seemed like a prudent measure to preserve the union.
Still, a lot of soldiers in the United States army insisted, as one Illinois soldier wrote to his congressman, "I will fight to preserve the union, but I will not fight to free Negroes." Lincoln responded to the congressman, and to the soldiers in general, "Negroes, like other people, act upon motives. Why should they do anything for us, if we will do nothing for them? If they stake their lives for us, they must be prompted by the strongest motive -- even the promise of freedom. And the promised being made, must be kept."
And so, by the end of the war, slavery was dead. Its worth noting that while the United State Army did not enlist men of African descent in the army after 1815, the navy did: up to one sixth or more of the men on its ships, until around 1840. The navy also began enlisting men of any complexion in 1861. This is because the sailors in the merchant and whaling fleets were a variety of skin colors, and the navy needed competent, experienced sailors.
Southern slave owners staked everything on one roll of the dice, and lost, big time. One reason Kentucky and Missouri declined to join the confederacy, was a calculation that they had a better chance of keeping title to their enslaved population by keeping the union as it was. They were right -- except the collapse of the confederacy took slavery down everywhere in the end.