I remember taking an oath when I enlisted in the Navy Reserve many years ago.
Federal law requires everyone who enlists or re-enlists in the Armed Forces of the United States to take the enlistment oath. The oath of enlistment into the United States Armed Forces is administered by any commissioned officer to any person enlisting or re-enlisting for a term of service into any branch of the military. The officer asks the person, or persons, to raise their right hand and repeat the oath after him. The oath is traditionally performed in front of the United States Flag and other flags, such as the state flag, military branch flag, and unit guidon may be present.
In the Armed Forces EXCEPT the National Guard (Army or Air)
I, (NAME), do solemnly swear (or affirm) that I will support and defend the Constitution of the United States against all enemies, foreign and domestic; that I will bear true faith and allegiance to the same; and that I will obey the orders of the President of the United States and the orders of the officers appointed over me, according to regulations and the Uniform Code of Military Justice. So help me God.
In the National Guard (Army or Air)
I, (NAME), do solemnly swear (or affirm) that I will support and defend the Constitution of the United States and the State of (STATE NAME) against all enemies, foreign and domestic; that I will bear true faith and allegiance to the same; and that I will obey the orders of the President of the United States and the Governor of (STATE NAME) and the orders of the officers appointed over me, according to law and regulations. So help me God.
Guide Note: There has been some controversy about whether the phrase “So help me God” is mandatory. I have seen officers allow enlistees to omit these words, if they choose, according to their religious preference and beliefs. However, federal law does not appear to make any part of the oath optional. See 10 United States Code, Section 502.
Now, what happens if the first part, defending the Constitution, is under attack from the second part, the president and the appointed officers? The third part, the UCMJ, clarifies it all with reference to obeying Lawful Orders. Of course, how is a simple enlisted service member supposed to know the difference? They are just following orders from the educated officers. Pity they don’t make acing the civics course a prerequisite for enlistment.