This is Samuel and I will discuss this and provide you information in this regard.
First no rights have gone out the window. Whether active military or not, every state has provisions to have a person involuntarily committed.
However, there is also a specific military regulation in this regard.
6. DUTY TO TAKE PRECAUTIONS TO PROTECT OTHERS FROM HARM
a. In any case in which a Service member has communicated to a privileged healthcare provider an explicit threat to kill or seriously injure a clearly identified or reasonably identifiable person, or to destroy property under circumstances likely to lead to serious bodily injury or death, and the Service member has the apparent intent and ability to carry out the threat, the responsible healthcare provider will make a good faith effort to take precautions against the threatened injury. Such precautions include, but are not limited to:
(1) Notifications. Privileged healthcare providers will notify:
(a) The Service member’s commander or supervisor that the Service member is imminently or potentially dangerous.
(b) Military or civilian law enforcement authorities where the threatened injury may occur.
(c) Law enforcement of specifically named or identified potential victim(s).
(d) The Service member’s commander or supervisor and any identifiable individuals who had been harmed or threatened harm by the Service member immediately before hospitalization about the Service member’s pending discharge from inpatient status.
(2) Recommendations and Referrals. The MHP will recommend as appropriate:
(a) Appropriate precautions to the Service member’s commander or supervisor.
(b) Referral of the Service member’s case to the Service’s physical evaluation board.
(c) Admission of the Service member to an inpatient psychiatric or medical unit for evaluation and treatment.
(d) Administrative separation of the Service member to the commander or supervisor.