In 2013, the U.S. Supreme Court upheld a Maryland law authorizing law enforcement authorities to take DNA samples from suspects arrested for serious offenses. Most states have equivalent laws, which treat cheek swabs similarly to fingerprints. (Maryland v. King, 133 S. Ct. 1958 (2013).) (All 50 have laws requiring collection of DNA from defendants convicted of felonies.)
The Maryland statute applied to arrests on charges of violent crimes and burglary offenses. It prevented authorities from processing samples or placing them in databases before arraignment, at which point the court would determine whether there was probable cause for an arrest. On the off chance that a judicial officer found that there wasn’t probable cause, the authorities had to immediately destroy the sample. The law also required them to destroy it if:
The DNA officers collected could be used only for identification purposes—for example, to determine whether the defendant’s DNA was found at the crime scene. They couldn't allow it to be used for other reasons, such as to match family members.
Privacy advocates in states like California have brought challenges to similar DNA-collection laws on the basis that they don’t contain the same protections as the Maryland statute. For example, in Haskell v. Harris, 727 F.3d 916 (9th Cir. 2013), the ACLU argued that California’s law violated the Fourth Amendment, in part because it allowed for the collection and preservation of DNA samples of those charged with less serious offenses and those who weren’t ultimately determined to be guilty.
In fact, in late 2014, a California court determined that the state DNA-sample law violated the state constitution. In 2015, though, the California Supreme Court decided to take up the matter. (For more on the travails of the California DNA Act, see California DNA Collection: Back in Effect.)
Regardless of the exact procedures involved, collecting the DNA of certain kinds of arrestees isn't inherently unlawful. The U.S. Supreme Court has said as much. But there may be circumstances in which the collection process violates the law.