People with bacterial pneumonia will usually be prescribed antibiotics that stop the infection from progressing. Pneumonia will usually stop being contagious a day or two after treatment begins.
A person is also considered contagious during a fever, so it is best to stay home from work or school until the fever is gone.
People who have been vaccinated against infections that can cause pneumonia, such as pneumococcal bacteria, are usually immune to those specific germs. Getting the vaccination can help prevent this type of infection from developing.