No, pneumonia is not exactly contagious. Although it is caused by infectious agents such as bacteria or fungus, being exposed to the agent is not enough to cause pneumonia. Normal, healthy people or pets will clear any bacteria/fungus that they are exposed to. If the individual is immune compromised for some reason, this allows pneumonia to develop.
So a human or dog with pneumonia can expose the other to a bacteria or fungus, but unless they are immune suppressed the bacteria will be cleared without a problem.
I hope that helps!
Please let me know if you have any further questions. If you are satisfied with my answer, please click on the green Accept button. Positive feedback is always appreciated. Thanks.