A person with pneumonia
coughs frequently & generates aerosols of small droplets in the air around them. These droplets contain infectious organisms from their lung & can be inhaled by others in their immediate vicinity (<3feet).
People at extremes of age (young & old) are most susceptible. Therefore it is advised to cover your mouth & nose when coughing & avoid going to public places when sick.