This is usually done by blocking the mouth, partially or completely, or attempting to prevent the tongue, lips, or jaw from moving in the normal patterns of speech.
For example duct tape is a fairly effective method of keeping a person's mouth shut but can be hazardous if the subject cannot breathe freely through the nose (for example if they have the common cold).
[1][2] One type of gag familiar in fiction, particularly in crime comics and novels, is a suitably sized piece of cloth pulled over the subject's mouth and tied at the back of their head.
This is common in BDSM, but in practice these sorts of gag can usually be dislodged by working the jaws about and/or pushing with the tongue, and they often do not stop the victim from making a loud inarticulate noise to call for help.
A tape gag can cause the skin on the lips to be damaged in its removal or the adhesive can cause chemical burns or reactions.