The only way it would be if by law would be if it follows impeachment and conviction by the Senate where that was the prescribed punishment (and the judge was just reinforcing it) or if it falls under the 25th Amendment which we've never faced so we don't know how that could play out but would be based on the decision of the VP and th majority of the cabinet, not a judge (unless he was reinforcing the order).