As it did in the Confederacy.
Union legislation to this effect - July 1862.
Confederate legislation - February 1865.
At which point things weren't going very well for the confederacy. There is very thorough documentation that Confederate enlistment of black soldiers was proposed and finally accepted only as the utter last gasp of desperation.
You seem to be suffering from the common delusion that anyone who thinks the Union cause was on balance the better must also believe that cause to be one of utter and complete goodness, with no racism or other unpleasant factors mixed in. Au contraire, I am fully aware that most whites of the time, north and south, were highly racist by today's standards.
I do not demonize the South. As Lincoln himself said, if I had been in their shoes, I would have not known how to get rid of slavery either. But I wouldn't have started proclaiming a great evil to be a positive good.
The Union was simply less racist than the Confederacy because it fought a great war, one of the causes of which was slavery and one of the consequences of which was the freeing of those slaves. One of, not THE cause.
It actually passed a few weeks later, on March 13, 1865.