Antibiotics are medicines used to treat infections caused by bacteria. Antibiotics don't work against infections caused by viruses, such as colds and flu. ... This is called antibiotic resistance and it happens when bacteria are exposed to antibiotics and learn to resist them.