Article 31 of Uniform Code of Military Justice (10 U.S.C. § 831) protects service members against compulsory self-incrimination and requires that they be informed of the alleged offense before being questioned.
Article 31(b) states that “no person subject to this chapter may interrogate, or request any statement from, an accused or a person suspected of an offense without first informing him of the nature of the accusation and advising him that he does not have to make any statement regarding the offense of which he is accused or suspected and that any statement made by him may be used as evidence against him in a trial by court-martial.”
In short, neither your commanding officer nor anyone else in your command can force you to answer their questions if they suspect you of criminal behavior; you have the absolute right to remain silent.
Furthermore, service members suspected of a crime have the absolute right to speak with a lawyer. It is essential to note that exercising these rights can never be used against you later in a trial.