Flagyl can be used to treat select infections caused by bacteria and other organisms in various parts of the figure. Additionally, it is used to prevent or treat certain problems that may occur during operation. Flagyl is actually an antibiotic that belongs to a group of medications labeled as nitroimidazoles. This medication works by killing or stopping the growth of bacteria and other organisms causing these problems. The doctor might have given Flagyl for another reason.