White blood cells are the cells of the immune system that are involved in protecting the body against both infectious disease and foreign invaders. When there is an infection, the body makes more white blood cells to fight of the infection. When there is a suspicion of an infection, the doctor will look at the WBC count (together with the CRP count, another sign of infection) to see how likely it is that there is an infection. If necessary, this can help aid in the decision to prescribe antibiotics.
When there is a too low count of WBCs the body is at risk of infections. The immune system will not function fully. This can be potentially lifethreatening if the WBC count is very low. For example, this is what happens in HIV or due to chemotherapy.
However, a high WBC count is not always functional. Sometimes a high WBC count is caused by other things, such as bone tumors or leukemia.
More information can be found here.