As per babycenter.com:
Your midwife or doctor will carry out the procedure. During an internal examination, she will sweep a finger around your cervix (neck of your womb). This action should separate the membranes of the
amniotic sac surrounding your baby from your cervix. This separation
releases hormones (prostaglandins) which may kick-start your labour.
My OB was going to do this at 39 weeks, so I read up on it. (I never had this done with DS) It can't be done if your cervix is entirely closed, FYI. It's usually done as a thing to get you over the "hump" of being 2-3 cm dilated but not experiencing labor.
It doesn't sound like the most pleasant of experiences!