That is incorrect. Freeing slaves had nothing to do with the reason for that war. Nobody intended to do that when the war started, and they certainly didn't free any slaves in the five Union slave states during the war.
The Union army was there to stop a financial threat to the power block running Washington DC. They did not fight for any noble or moral reason, they fought to enslave others who didn't want to be ruled by corrupt Washington DC.
“That is incorrect. Freeing slaves had nothing to do with the reason for that war. “
You can argue that point with Wikipedia. Here’s how they start their article on the American Civil War.
“The central cause of the war was the status of slavery, especially the expansion of slavery into territories acquired as a result of the Louisiana Purchase and the Mexican–American War.[14]”