Detaining people against their will is the definition of imprisonment.
While not illegal there should be comprehensive legal safeguards around it. And, if it's not illegal, what are the laws that regulate quarantine in the US?
The sub pages are lengthy and cite specific laws and so on.
Skimming, CDC has broad authority to detain travelers and states and local health departments usually have the power to enforce a quarantine (with violation of the quarantine being a misdemeanor).