Slavery was a very big problem. In this article it shows how some slaves could escape during the war. It also states how other slaves had it worse during the war because they had to build fortresses, dig, work in factories, and carrying supplies to the frontlines.
There was a big debate during the civil war about slavery. People were debating if they are just getting rid of slavery or trying to save the Union. I think that most people thought that saving the union was the main priority and very few cared about saving/destroying slavery.
During the civil war, many slaves fled their owners and went behind Union lines to see wherever those took them. Many other slaves could/would not leave their owners and either were freed after the war or died during it. Many of the slaves that wouldn't flee didn't do it because they did not want to leave their families.
Virginia had the most black slaves in any confederate state and the slaves in that state responded to the civil war in multiple ways. Some volunteered to support the confederate war effort while others were forced to support confederacy. Thousands of slaves escaped to the Union army lines and earned their freedom.