First, thank you for reading what I wrote and asking a great question that I could of have done a better job of explaining.
When the Civil War began there was no appetite to free the slaves by the Union. In fact, many slaves escaped and ran to the Union camps asked for protection, safety and to help the Union fight. Union Generals did not want anything to do with the escaped slaves at the start of the war. In fact, they allowed slavers or their associates to come into the Union camps and reacquire their "property" others kept them as the spoils of war. Look at the section on Contraband Of War in this link.
https://www.loc.gov/exhibits/african-american-odyssey/civil-war.html
You might have seen or heard of the Leo and Martin movie: The Gangs of New York. What the movie fails to talk about is the riots and the fighting was because the Irish did not want to go fight in the Union Army, because they did not want to free the slaves and take their jobs. So they went on a murderous rampage lynching black people in New York City. Here is an article that combats the whitewashing of the real cause of the riots.
https://www.socialstudies.org/system/files/publications/articles/se_6704213.pdf
The Slaves were freed because the Union needed soldiers and black people were ready to fight, kill, and die for freedom. Too many white people did not want to fight to free black people and then those black people come and take their jobs. In order to keep power and their way of life the Union freed the slaves.
Then Lincoln wanted to send all of the freed people out of the United States. He did not believe in integration...he just wanted to use this black fighting force to maintain his power and the power of his friends.
https://www.history.com/news/abraham-lincoln-black-resettlement-haiti
Thanks for reading this and asking a great question, I hope this helps.