You could have pulled a muscle or a disc. Best thing to treat this is simple: relax, and stay off your feet for awhile, and certainly don't do anything which is rigourous.
If one has pain on the right side of ones back it may be due some problem in the spinal cord. It may be something related to any slight problem in the heart but can be cured. First sleep on a flat surface without pillow there will surely be great relief from pain. Then better to consult a doctor
Pain in the right side of the back could be a back sprain, a kidney stone or even a gall bladder problem. You should see your physician for a diagnosis.