Yes. Barring high-risk pregnancies, sex is considerably safe throughout all three trimesters. The baby is well protected in the womb, with a mucus plug acting as a barrier between her and “the outside world.”
Of course, any pain or discomfort during sex should be consulted with the doctor. There are a few positions you could do during early pregnancy that will now be uncomfortable or even unsafe. For example, avoid lying flat on your back after your 4th month. By then, your growing baby’s weight might constrict major blood vessels. Lying on your side (facing each other or spooning) and woman-on-top are belly-friendly.