The compression of nerves after they leave the spinal cord can cause leg spasms. Spinal nerve compression can create conditions that affect the spinal column, such as osteoarthritis, spinal tumors and herniated disks, according to MayoClinic.com.