Is bacterial pneumonia contagous?

Not generally. It will obviously depend upon the organism causing the pneumonia and the extent of exposure and your immune status. The short answer is that if this is streptococcus pneumoniae, the most common bacterial pneumonia, as a general rule something in your system predisposes you to this and it is likely to already be resident in the back of the throat.
Yes. Cover you mouth with a tissue if coughing, wash your hands before and after touching your face/nose. Keep a distance of about 7-8 feet. Keep elderly the very young (2 years) or the very fragile away while recovering from pneumonia. Wear a mask if needed.