Yes if you feel like you truly need it. I was scared to take prescribed pills that the doctor gave me but they wouldn't give you anything that would harm your baby.
Im almost 7wks pregnant and on 50mg of sertraline for anxiety. There are a few risks with every med while pregnant however your doctor felt the benefits over ruled. Sertraline is probably the safest antidepressant to take while pregnant. Ive talked to people who took it while pregnant and have had healthy strong babies. One lady i spoke to even had 3 beautiful baby girls while taking 100mg during all 3 pregnancies. Try not to worry to much. Everything will be fine.
All medications have risks but If the doc felt comfortable prescribing it then you are fine to take it