Unless there are complications with the pregnancy, it's safe to have sex because the foetus is protected by a cushioning sac of amniotic fluid that surrounds it. Think of an egg from the store: your baby is like the yellow yolk part in the middle of all that egg white.
Hormonal changes can affect sex drive
Now, pregnancy can affect sex in other ways. For example, hormonal changes that accompany pregnancy often influence a woman's moods, which could alter her desire to have sex. For some couples, nausea, physical discomfort, weight gain, and changes in energy levels may present challenges to sex and the enjoyment of it. As a result, an expectant couple may want to discuss experimenting with many different sexual positions, as well as try other ways to have pleasure in case one of the partners does not want to have intercourse. Changing positions is important because some women may experience sex differently while they're pregnant; what they found pleasurable before conception may no longer be the case.
That's why it can help for the woman to listen to her body and act appropriately. This is particularly true if a woman has any pain or uterine bleeding, or if her "water is broken," in which case she'll need to avoid sexual intercourse or penetration altogether and see a health care provider right away.