The 2022 National Defense Authorization Act (NDAA) contains a provision allowing military courts to issue orders restraining military personnel from "possessing, receiving, or otherwise accessing a firearm."
The 2022 NDAA — H.R. 4350 — contains the provision for prohibiting gun possession in Section 529, which is titled, "Authority Of Military Judges And Military Magistrates To Issue Military Court Protective Orders."
The provision appears under the subtitle, "Restrictions On Access To Firearms," contained in the directives for protective orders. It gives military courts the authority to prohibit gun possession via protective orders in two ways: 1. By giving the subject of the order an "opportunity to be heard on the order." 2. By issuing the order ex parte.
Within 72 hours of issuance, the order is to be delivered to the Attorney General of the United States and "the Attorney General of the State or Territory in which the order is issued."