Since the US Federal government didn't try to pass any such law (nor would it have been politically possible in the period shortly before the US Civil War), there is no way to know with assurance how such a hypothetical law would have been addressed by the Supreme Court of the day, nor by the various states.
Congress legally could have prohibited the importation of slaves after 1808, the constitution specifically grants this power.
Congress legally could have prohibited interstate commerce in slaves.
Congress could have repealed the Fugitive Slave Act.
Congress legally could have imposed heavy taxes on the ownership of slaves. If heavy enough these could have been a de facto abolition.
A series of Presidents could have appointed Justices inclined to overturn the Dred Scott decision (denying the possibility of citizen ship for most Negros, and denying that a "free" state could free slaves temporarily resident there).
Congress could have passed laws requiring negro votes to be counted in federal elections.
Various of the above hypothetical measures might have made slavery less economic, and thus less common, in time. Note that it is not likely that any actual Congress would have passed most of them.
But I do not see how, absent a constitutional amendment, and absent a war, a simple Federal statute could have constitutionally abolished slavery de jure throughout the US. Lincoln's Emancipation Proclamation was legally justified as a war measure, a confiscation from those in rebellion. It did not affect loyal slave states, such as Maryland. And it was never seriously tested in court anyway.