Yes the TD injection is a vaccination shot for tetanus and diphtheria. This vaccination is safe for pregnant women. Vaccines can be given after 24 weeks of gestation.
This vaccination is intended to protect mothers from tetanus and diphtheria which are caused by germs and are dangerous. It is assumed that by giving this vaccination the mother can give antibodies to the fetus she is carrying so that the baby also has antibodies and is immune from this disease during the first few months of life after birth.
Of course, tetanus and diphtheria vaccinations for your baby will be needed according to his age schedule.
Hope this clarifies.