How far along are you? I'm not sure about stress, but my OB agrees to 2-3 weeks before due date for pain, swollen feet.. medical stuff. Its really on your employer and how long they are going to allow you to have leave. My employer only allows 6-7 weeks of leave. Depending on if your Dr okays to go back to work PP. Talk with your employer first, then ask your Dr
Your Dr can literally write you a note for anything to put you at home. They can say the stress is too much for the baby and you and order work restrictions or patial bed rests.
But...you should talk to your employer and dr first about just managing your stress levels at work. It might simply be a change in your duties and your fine. Your employer legally has to try and accommodate you.
I was a toddler teacher at a daycare and my dr put me on lifting restrictions which meant I couldn't do diapers 6 times a day like before and my boss simply sent a breaker to my room so assists to help out no questions asks.
It's not the work that's causing the stress it's the people I work with. I literally cry every morning because I do not wanna go into work and be bothered by any of them. It gives me a headache I can't concentrate cause I'm so focused on if I'm almost off yet.