If a mother is pregnant and gets itp while pregnant, does the baby contract this disease at the same time?

Passive transfer can. Unfortunately, the maternal antibodies are usually of the IgG class and can cross the placenta, more commonly in very late pregnancy. If this does occur it is of short duration, since the child makes no platelet antibodies. It is not severe for most, if it does occur.
Maternal ITP. If mom has itp, i would certainly follow platelet levels in the newborn child. If low, i would consider treatments to improve the platelet count.