Pneumonia could definitely cause your back to hurt when you cough. Pneumonia is a deep lung infection, and the areas adjacent to your lung tissue can become inflammed as well and cause pain.
Take care of yourself, get lots of rest and fluiRAB, and listen to your doctor's orders - pneumonia can be very serious at any age.