A gag is a piece of cloth that's tied around a person's face to keep them from speaking or being heard. Cartoon bad guys often tie up their victims and put gags over their mouths.
To use a gag for shutting someone up is to gag them. Both the noun and verb forms of gag can also be figurative: "Her government is trying to gag her by censoring her," or "The lack of a right to free speech in some countries is a gag." Another way to gag is to retch, or begin to vomit. The root of gag is probably the Old Norse gag-hals, "with head thrown back."