Threats of violence are illegal. No law forces a government to engage in a discretionary act in the face of threats of violence, nor do laws prohibit such decisions. The choice to "make a law" (issue an order) is entirely political, and the threat of violence is one of the motivations behind some political acts.
Governments generally have enacted emergency powers laws that say what the governor / mayor / county executive may do in emergency situations. They are generally written to anticipate circumstances surrounding natural disasters, uprisings and invasions, and disease outbreaks, and empower the executive to issue whatever orders are deemed necessary for public health and safety. They can differ a lot in how specific they are.
There are a few rights that are expressly spelled out in the Bill of Rights (freedom of speech, right to bear arms, quartering soldiers etc.) which constitute a bright line that cannot be crossed. There is no explicit constitutional provision that protects your right to contract, but it was generally held that there are other rights that are implicit in the Constitution, or that follow from other provisions (until the court decided otherwise). Even though there is no express constitutional provision guaranteeing that you have the right to walk around in public peacefully minding your own business, this is generally held to be a fundamental right. The Supreme Court then may at some point identify a fundamental right, as they have done (the rights to marry, vote, procreate or use contraceptives...).
The government cannot infringe on fundamental rights unless they do so to achieve a compelling government interest (public health and safety is a good example), and then the question is whether an infringement is properly justified. For that to happen, the law has to be narrowly tailored to the purported purpose, and be the least restrictive way of achieving that end.
As for mandatory face masks, there is a potential equal protection argument related to the fact that it may be illegal to wear face masks in public. Some of the arguments set forth relate to the disproportionate impact upon the poor or the disabled (if they cannot wear a mask for compelling reason). It imposes an extreme burden on the poor and especially the homeless (I'm not one, and I cannot get a face mask in the store. "Order it on Amazon" isn't an answer for many people). So mandatory (public) masks significantly infringes the right of people to live (buy food), and does so unequally.
Whether or not such considerations are upheld to the highest courts remains to be seen.