Breast pumping or any kind of nipple stimulation releases a hormone oxytocin into the body which causes the uterus to contract. It all depends on your body if you go into labor. My friend breast feed her first baby while pregnant with her second and she was fine, but everyone is different.
It can cause you to go into preterm labor.
There's no need to pump at 31 weeks I don't think but I've heard nipple stimulation can cause that so maybe so just be careful