The same way any judge would enforce a gag order- sanctions can be imposed under the contempt powers of the court.
What, Trump gets held down while the judge ties the gag around his head?