Trump and Musk may not pay attention to the constitution, but I understand that the US armed forces swear allegiance to the constitution — while they must obey lawful orders of the president, unconstituional orders must be refused even if from the president.
https://en.wikipedia.org/wiki/United_States_Armed_Forces_oat...
https://en.wikipedia.org/wiki/United_States_Uniformed_Servic...