First of all, I would assert that it's never ok to use the military to crush internal unrest. Such measures are the hallmark of dictators and failed states. Some people however, might be inclined to justify the use of military force if the stakes are high enough. Trouble is once you open that door, who is to say where that line gets drawn?
Well, we don't actually have to ponder that question. The U.S. government has already given us their answer. Unfortunately according to a 2010 Department of Defense document entitled Directive 3025.18, the military is authorized to deploy within the U.S. to quell civil disturbances "when necessary to protect the Federal property or functions."
That's very broad, especially considering that the document discusses the conditions under which lethal force may be used. Soldiers are trained to kill. That's what they are good at.
You can download the document directly from the U.S. military's own website here. You can also view an embedded version at the bottom of this page. Believe it or not, this document is not classified at all.
Federal military commanders are provided EMERGENCY AUTHORITY under this Directive. Federal military forces shall not be used to quell civil disturbances unless specifically authorized by the President in accordance with applicable law (e.g., chapter 15 of Reference (d)) or permitted under emergency authority, as described below (see DoDD 3025.12 (Reference (j)) and DoDD 5525.5 (Reference (c))). In these circumstances, those Federal military commanders have the authority, in extraordinary emergency circumstances where prior authorization by the President is impossible and duly constituted local authorities are unable to control the situation, to engage temporarily in activities that are necessary to quell large-scale, unexpected civil disturbances because:
(1) Such activities are necessary to prevent significant loss of life or wanton destruction of property and are necessary to restore governmental function and public order; or,
(2) When duly constituted Federal, State, or local authorities are unable or decline to provide adequate protection for Federal property or Federal governmental functions. Federal action, including the use of Federal military forces, is authorized when necessary to protect the Federal property or functions.
If you read through to the end of the document you will find that it states that unless this directive is revoked in 2015 it will remain in effect until 2020. Nice.
Seems like somebody's afraid that the peasants might get restless someday.