A gag order is an order to remain silent. Gag orders are frequently given by courts. However, other areas of government and other authorities can give them too. Gag orders are often used by courts when the trial is receiving a lot of attention from the media. In these circumstances, the court may issue a gag order to participants in the trial to not discuss it with reporters. This could be because the court is trying to prevent jurors from being influenced by the media.
Gag orders are basically the court's or another authority's way of telling people that they must be silent and not speak publicly about certain issues. Gag orders are primarily used by courts to try to keep the proceedings of trials as fair and unbiased as possible. For example, a court may know that if a lawyer gives an interview to a news network, then that interview may be analyzed by pundits on national television. These analyses could influence jurors. So, the court may issue a gag order in these circumstances to try to keep the jurors focused on the trial.