There is no definitive answer it really is as long as you are happy and feel safe to do so.
For me I was still riding at 36 weeks, and intended to carry on, because I felt fit, well my horse could carry me. But then the snow came and as he couldn't be ridden I decided to stop.
I agree with the earlier posters, as long as you feel comfortable and your horse can carry you. I gave up at 10weeks because I had had an earlier miscarriage and would never have forgiven myself if I had fallen or banged myself. That said, I continued to care for my horse myself - I mucked out on the day I gave birth. Your choice!
I didnt have horses when pregnant, but friend who did do it as long as its comfortable to do so. Our YO is 6 months gone and still rides and mucks out each day - she just get on with it. Compare this with an employee of mine who is 4 months pregnant - she wont even pick up a tea cup - no she doesnt ride, and its a first baby, just comparing notes really.
As everyone else has said, as long as your doctor/midwife is happy and you feel comfortable.
When I was pregnant first time around I had two horses and gave up riding about 36 weeks, mainly 'cos getting on and off was getting more difficult!
Second time around I only had the one horse and gave up around 7 months as I was starting to find it uncomfortable.( I was bigger that time!)
Each time I carried on mucking out, looking after the horses etc. until I was 10 days overdue.
I hardly rode at all - to start with I had horrendous morning (all day) sickness, plus riding made my hips/pelvis very painful and unstable and I could hardly walk for a day or two after a 15 minute session, plus it got worse each time I rode. By the time I felt less ill, I was quite big and uncomfortable and frankly I just didn't want to get on a horse. If I had not had to work then maybe I would have had the energy, but it wasn't just that. I also felt I didn't want to take any risks as not worth it. Perhaps I'd have felt differently if I had a horse I was producing, but that's not the case and so there wasn't the pressure to stay in the saddle as long as possible. Still had to find someone else to ride him though.