Off work?

Can your doctor dismiss you from work if you’re in constant pain? My hip pain and back pain is so bad. I have a desk job but I can’t get up and go to the printer or bathroom without being in terrible pain. Getting out of bed is a chore. It hurts so bad. He’s given me pain pills for my back but they barely work. I get shit talked at my job and it making me go crazy. My hubby doesn’t want me to quit yet but I can’t deal with it. Can my doctor write an excuse to be off until birth? Do you think he will?