If the spine hurts, not the muscles, it indicates a herniated disc. When one bends sideways, the discs are crushing against each other due to the herniation and one feels pain.
Check to see if there is a herniated disc. If so, have someone run a hand down the spine. See if one feels a protrusion or an indentation and any exaggerated curvature. If there is a protrusion, bend backwards. If there is an indentation or an exaggerated inward curvature, bend forwards. Bend backwards or bend forwards very slowly, very very slowly.
After the herniation is alleviated, then try bending sideways to see if the spine still hurts. It should not.