So if anything were to happen were it came to the point either to obey a order from a dictator, or side with the people, our military would most likely side with the people and up hold our constitution.
Still, I think it unlikely they'd attempt a coup at all.
If would have to be a very clear and massive case of abuse of power. Perhaps these things might cause it to be considered, but I can only think of two, as follows:
—Ordering Republicans or large amounts of citizens to be rounded up and killed for no reason except they disagreed politically.
—Massive national and complete gun confiscation, that would lead to violence by citizens resisting and the military ordered to fight and kill those same citizens.
These type of things might launch a coup, but not all generals and admirals, and heck, other officers and NCOs would agree. It would not last long in any case, and in that I mean the military might apprehend the president and congressional leadership and ask right-minded, non-partisan officials to step in and stop the madness, conduct impeachments, etc. It would very difficult for them to try to hang on to power which would simply trash the Constitution—due to their oaths, but there is the clause about “All enemies, foreign and domestic”.
The problem with that clause is it's always been the political officials who get to define the enemies. When the military starts self-defining it, all bets are off, but I still contend that they would be much more likely to see such enemies coming from the Left.