Metronidazole is used to treat a variety of infections. It may also be used to prevent infections after certain types of surgery (e.g., bowel surgery). Metronidazole belongs to a class of antibiotics known as nitroimidazoles. It works by stopping the growth of bacteria and protozoa.