That's the question addressed in "The First Amendment and Public Health, At Odds," American Journal of Law & Medicine, 39 (2013): 298-307, by Ted Mermin and Samantha Graff. Here's the article's first couple paragraphs (with the footnotes omitted):
At the turn of the last century, allies of industry on the Supreme Court deployed a novel constitutional doctrine to thwart government regulations aimed at improving public health and safety. During the Lochner v. New York era, the Supreme Court discovered a right to “freedom of contract” in the Due Process Clause of the Fourteenth Amendment that advanced the “economic liberty” of businesses to conduct their affairs without government oversight. The newfound freedom of contract forbade, for example, public policies aimed at improving factory conditions by setting maximum working hours, forbidding child labor, or setting a minimum wage. The Court later somewhat abashedly changed course, finding that government in fact had great leeway to implement economic regulations protecting and promoting general welfare.
Today, seventy-five years after the Supreme Court repudiated the doctrine of economic substantive due process, the Court has backtracked to the notion that the Constitution significantly impedes the government’s ability to safeguard public health and safety by regulating commercial activities.The old result has been achieved, however, with a new instrument. Rather than the Fourteenth Amendment and freedom of contract, the Supreme Court has now turned to the First Amendment and freedom of speech.