Some possibilities to express that:
I slept wrong (or so I think) and now my back is killing me!
Yesterday I went to bed, slept and then - in the morning - I woke up with my back hurting.
I went to bed and slept, next morning my spine felt hard and stiff/tight. Difficult even to walk/move!
Note: dormir de mal jeito (could be => to sleep wrong.)