Something similar to this happened to me about a month or so ago. Im 29 weeks now. I had shooting pain on the right side of my stomache so bad I could barely stand! I went to the er and they said I had pulled a ligament in my sleep. They couldnt do anything for me besides telling me to take Tylenol. It lasted well into the next day. I would recommend you relax as much as possible and it will go away on its own.
The baby could be laying on a nerve or it could be a ligament.