Yes, it is definitely safe. I had 3 children and had sex during the 2nd and 3rd trimesters. Granted, you may not feel like it. But after the baby comes, you have a 6-week moratorium and really, really may not feel like it. Use positions that are comfortable.
If you are overdue, having sex might actually help send you into labor. Late in the game, orgasm can create some hormonal reaction that might stimulate contractions.