I once had such situation. My contact lenses roll back to my eyes because of the rolling of the eyeballs. I stay calm. I roll the eye balls and turn the eyeballs back to the normal state. It spends me several minutes. Thus you should not wear the contact lenses and get asleep which may easily cause such problem. You just need to wear the contact lenses in the right way.
It is quite normal that when you first began to wear eye contact lenses they just did not stay on the surface of the pupilla and roll to other sides and are hard to take them out of the eyes. This is often because that you did not wear the contacts in a right way, or the diameter of the eye contacts did not match you pupilla. To solve this problem, when you have put on the eye contacts, you can close your eyes, and turn your eyeballs in the same direction for some circles, thus under the assist of the eyelids the eye contacts can be adjusted to the right ahead of the eyeballs. As to how to get out of the eye contacts in a safe and quick way, you can first of all apply some drops of preservative solution to lubricate the eyes so as to easily take out the eye contacts. By the way, you should not keep long fingers, because the long fingers will also make it hard to take out the eye contacts.
I have ever encountered such situation. It is not that harmful, but it makes me feel uncomfortable. Under such circumstances, you can close your eyes and roll your eyeball; the contact lenses can then be back in the right place. If it does not help, your contact lenses perhaps get stuck under your upper eyelid, you can drip some rewetting drops to your eye and massage your eyelid gently with your eye folded or you can turn your upper eyelid inside out to find out the contact lenses and take them out gently. If you cannot succeed in getting it out of your eye, ask someone to help you.
When you put the lens back you need to manipulate it using the eyelid itself - puttiing your finger in your eye risks hurting your eye as you have found out. When all lenses were hard opticians used to make you practice this before releasing you into the wild with your lenses but as it happens less with soft contacts they dont' seem to do it any more.