Yes and yes to both of those questions.
The hormone that causes your uterus to contract in labour is oxytocin. It's commonly referred to as the 'love hormone' as your body naturally produces it when your feeling relaxed, cuddly, mushy and all lovey dovey. And when you orgasm you exude oodles upon oodles of the stuff! There's just an explosion of oxytocin!
Prior to pregnancy, the uterus only has a small number of oxytocin receptors. It has enough to react to the hormone (which is why orgasm often helps with cramping during menstruation), but there is certainly not enough to cause labour or miscarriage. Throughout pregnancy, one of the side effects is the amount of oxytocin receptors the uterus has increases more than 10 fold. So essentially, the timing works out so that you develop just enough oxytocin receptors required for labour just as baby is ready to be born. The body is an AMAZING thing
And that's why, towards the end of pregnancy, once your uterus and baby are ready for the birth sex can stimulate the onset of labour. I've known MANY women who been kick started into labour through orgasm and I experienced it myself firsthand when I birthed my son.
But all that applies to NORMAL uncomplicated pregnancies. There are situations in which women are at risk of preterm labour and should avoid intercourse, but in those situations there are other factors at play, abnormalities with their cervix, bleeding concerns, etc.
As for uncomplicated healthy pregnancies, it's fine to play all pregnancy long