The bill only relates to those subject to the UCMJ, and is granting ex parte orders by a military court. Once you're out, you're out.
@bachelorjack is 100% correct, you have no rights as a service member. It's one of the major reasons I did 14 years and left my potential retirement on the table, gladly, and I regret it far less now than the day I did it. Not your monkey, and not in your circus Mr. SecDef...
On the bill itself, the annual defense authorization act is always full of bullshit like this, both sides fill it with honey-do's and pet projects to pay back their funders. This is no different, and also no different than all the rest of the bullshit red flag laws that change nothing. There's already processes in place, a commander can order anyone in their charge to restriction on a whim, just like a doctor or mental health professional can place anyone in danger of themselves or others into temporary residential care pending court review in a few days or so with an assessment and a stroke of a pen, and that is active in all 50 states in some form. In that court review though, the committed person can defend themselves and has a right to legal representation. All this opens up is people to go around the system, get a judge to order it without a person having the ability to defend themselves or even be aware of the proceedings at all, and the accused cannot even have access to their accuser to counter their claims.
Red Flag laws are amongst the most egregious violations of the US Constitution, spread the word that they must be fought at all angles and let people who aren't in the know, know how bad of a violation of the peoples' rights they are.