Sex can help foster a feeling of closeness for a couple during a time of very significant transition. It will not harm a healthy pregnancy.
There are a few situations where it is not advisable to have sex in pregnancy. If you have a placenta previa, where the placenta is lying over the cervix, it is not safe to have sex because sex can trigger uterine contractions which can cause bleeding. Also, if there is bleeding in the first trimester, it is best to check with your doctor and then avoid sex until the health of the pregnancy has been assessed and the bleeding has stopped. In most cases sex can resume as the pregnancy progresses. If you have experienced preterm labor it is best to avoid sex because sex can cause more contractions.
Outside of these situations there is no problem with having sex in pregnancy.