Yes, at the expense of individual liberty. Traffic laws are an obvious and rights-restraining example of this.
I may or may not cause harm by running a red light in the middle of the night, or speeding on a freeway -- in fact, I know a guy who habitually runs reds at night, "just because" -- yet the constitutionality of ticketing people for running reds or speeding is not, as far as I know, in dispute.
How this maps onto public health in a pandemic, I don't know.