Respiratory droplets. Pneumonia is spread from person to person via respiratory droplets released when a person coughs, sneezes, laughs, or talks. The bacteria can live in a person's throat without causing symptoms, so you can even get it from a person who doesn't look sick. Avoid the spread of germs by washing your hands regularly, covering your mouth when you sneeze or cough, and being cautious around sick people.
Apsiration. Most bacterial pneumonia is due to a small amount of oral pharyngeal secretions being aspirated or trickling into the windpipe and entering the lungs. In some people the mouth can become colonized with germs and then when these get into the lung they cause infection. Pneumonia is not typically caused by person to person transmission, but there are exceptions like tb, when coughed up are inhaled.