You may be having signs of disc protrusion. The discs are located in between the vertebral bones of the spine.
Coughing and sneezing increases pressure in the disc. If it has already pushed out of its normal space, this increased pressure may be enough to press on the nearby spinal nerve causing your back and leg pain.
It might be best to see your doctor about this problem, especially if this is a new symptom for you. Early diagnosis and treatment of disc problems can prevent chronic pain and disability later.