Sometimes your immune system is not able to activate itself quickly enough to outpace the reproductive rate of a certain bacteria, or the bacteria is producing a toxin so quickly that it will cause permanent damage before the immune system can eliminate the bacteria. In these cases it would be nice to help the immune system by killing the offending bacteria directly.
Antibiotics work on bacterial infections. Antibiotics are chemicals that kill the bacteria cells but do not affect the cells that make up your body. For example, many antibiotics interrupt the machinery inside bacterial cells that builds the cell wall. Human cells do not contain this machinery, so they are unaffected. Different antibiotics work on different parts of bacterial machinery, so each one is more or less effective on specific types of bacteria. You can see that, because a virus is not alive, antibiotics have no effect on a virus.
One problem with antibiotics is that they lose effectiveness over time. If you take an antibiotic it will normally kill all of the bacteria it targets over the course of a week or 10 days. You will feel better very quickly (in just a day or two) because the antibiotic kills the majority of the targeted bacteria very quickly. However, on occasion one of the bacterial offspring will contain a mutation that is able to survive the specific antibiotic. This bacteria will then reproduce and the whole disease mutates. Eventually the new strain is infecting everyone and the old antibiotic has no effect on it. This process has become more and more of a problem over time and has become a significant concern in the medical community.