Specifically for the United States, such legislation would run into stiff opposition from Constitutional Originalists, Libertarians, and the like.
The forced collection of genetic material from the general populace would be a direct affront to the protections against government overreach enshrined in the 4th Amendment.
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched,
Maryland v King doesn't apply in the idea presented in the question, because the decision and case was narrowly scoped to being associated with some one already lawfully detained. Though, forecasting the possible future of using DNA in policing, the late Justice Scalia wrote the following in dissent.
"Today’s judgment will, to be sure, have the beneficial effect of solving more crimes; then again, so would the taking of DNA samples from anyone who flies on an airplane (surely the Transportation Security Administration needs to know the “identity” of the flying public), applies for a driver’s license, or attends a public school. Perhaps the construction of such a genetic panopticon is wise. But I doubt that the proud men who wrote the charter of our liberties would have been so eager to open their mouths for royal inspection. I therefore dissent, and hope that today’s incursion upon the Fourth Amendment, like an earlier one, will some day be repudiated." - Justice Scalia
On review, there is a curious additional question: would this be considered forcing an individual to bear witness against themselves if a sample is taken from the person?