In "The Dragon and the Wolf" (Game of Thrones, S07E07),
Jon tells Cersei he can't stay out of the war because he's already sworn allegiance to Daenerys.
Afterward, Daenerys tells him that she respects his honor to his word, but she wishes he had just promised to stay out of the fight. This question explores why it would have been a bad choice for Daenerys to release him from his oath, but why didn't she just order him not to fight in the war, without releasing him from his oath of allegiance?
Since he's sworn allegiance to her, isn't he honor-bound to follow her orders?
Cersei said that she wouldn't trust Daenerys's word but that she would trust Jon's, so I'm assuming that would include the case where he follows Dany's orders not to fight and gives his word that he'll do so.