Cannot physically work till due date

I’m already 35 weeks and I am dying, my job has me walk about 15,000 steps a day. My body hurts and I have severe headaches. I asked my doctors to give me a note to take early maternity leave otherwise my boss said I cannot have off until my due date. I know other women take leave before their due date and I just want to know how because I physically cannot take this.