Because the spasm of the cough gives your back a sudden hard jerk. There are two things to do: 1) Get some healing attention for the back pain or vulnerability that is being triggered by the cough (chiropractic or massage are likely ways to help), and 2) meanwhile, whenever you feel a cough coming on (or a sneeze, if those are also bothersome), reach out with one hand and hold onto something stable, like a door-frame or piece of furniture. That will stabilize your body so the cough doesn't jar your back so much.
Because you lungs are close to your back. you probably pulled a muscle and when you cough, your lungs are pressing on that muscle.