-
The slaves were, legally, the property of the slave owners.
-
The United States was at war with the Confederacy.
-
A nation may, in the course of prosecuting a war, deprive its enemies of property without compensating them for it.
Therefore, depriving the southern states of its slaves was (legally) no different than raiding a supply depot and making off with bundles of rations and ammunition.