Vaccine while pregnant

My doctor mentioned getting the pertussis (whooping cough) vaccine at my next appointment. They say baby will take the antibodies from it, and it will be in his system once he's born. However, baby will be vaccinated for whooping cough as soon as he is born anyway. His father and I fully plan to take the shot once he is here, but do I need to take it while pregnant?? Seems odd to take the shot now so it could be in babys system at birth, when it will be given to him later anyway?