Warm up your muscles by doing some light exercise first, such as jogging.
Then do some slow medium type of stretches before attemping to do the splits, ie:
-standing with legs shoulder distance apart, touch hands to floor (don't push it, just do it slowly)
-spread legs into larger V, then lean to left and hold, then to right and hold
-face left or right and bring the front leg at 90 degrees, and the back leg perfectly straight. Bob slowly to stretch it more. Hard to explain this one.
Then, attempt to do the splits slowly by wearing socks and going onto a tile or wood floor. First, step into a wide comfortable V, then place your hands flat on the floor in front of you, and then slowly let your heels slide along the floor, making sure that your arms are firm and that you can hold yourself up. Get to a comfortable stretch, then hold. Do the same doing left and right splits. If ever in trouble just fall back or to the side, but it's quite simple and safe really, and works really well.
If you have a friend who can help you, stand with your back against the wall, and have them slowly lift your leg up towards your head. Make sure you keep your both your legs and back completely straight, and don't push it. Make sure your partner stops at a comfortable height, then hold it there. After a minutes, raise it just slightly. Then try with your shoulder against the wall, and then facing the wall with your back parallel with the floor. This will stretch it in all directions.
*PS - don't do these stretches quickly and from side-to-side fast, it is best done holding it for longer slower amounts of time, then it is to try to do them fast.