Last night I woke up in the middle of the night with an excruciating pain in my knee....like after maybe being in one position for a couple of hours. I tried to move so the pain would go, but it hurt more on moving. This lasted about 2-3 minutes, then the pain subsided and I changed sides and slept. I am 27 years old. What could this be?
I was going to say many of the things which have been mentioned above. I started getting a pain like you describe while I was sleeping and tried to move. By the time I woke up enough to try to figure out what had happened, I had already moved into a new position and couldn't remember how I saw laying.
One thing which helped me avoid this was sleeping with a pillow between my knees. It really did help keep my hips and knees in good positions.
Also, with any new pain or difficulties, it is important to see your doctor who might be able to give you more specific advise.
It could be any number of things. You don't mention any aggression or in your profile whether you have been diagnosed with RA, which makes it hard to narrow down the advice - if you give us a few more details about your medical history, it would make it easier to give you better advice.
Regardless of whether you have RA or not, I'd recommended that you go see a doctor to get checked out.
Why Yoga Can Help Soothe Many Types of Chronic Pain
Using Mindfulness Meditation to Alleviate Physical Pain
The episode you had is sometimes called a "theater sign", as in sitting in a theater with your knee in one position for an extended period of time. You probably had it in just the right position to pinch a cartilage or compress two rough joint surfaces. You may have it occasionally but it's probably not something to be overly concerned about. Should it become more consistent, have swelling or heat you ought to get it checked out. You might try sleeping with a pillow between your knees when on your side or under your knees when lying on your back.
Hope this helps and you never have it again.
It is hard to say what caused the pain. Sounds like you were sleeping in a position to compress a nerve. I say this because the pain did not last very long and subsided significantly in order for you to go back to sleep. Did you have any other pain? Was there any swelling involved? Did you wake up in the morning with the pain? If so, how long did it last?
Is this the first time you have had this type of pain? If not, keep a journal of the whos whats whens wheres and hows and bring it to the attention of your GP (General Physician or primary care physician) if you have one. A doctor will want to know about everything including some of the questions I asked you.
If this was the first and last time this happened then I wouldn't think you have much to stress over. Just stay aware of it and bring it to your doctors attention for evaluation should it continue.