Is it safe to have sex while pregnant?

YES. Sex is ok in pregnancy as long as there are no complications of the pregnancy (e.g. Previa, bleeding, pre-term labor.....). Another consideration: is the relationship monogamous? --if not then there are risks to you and baby (you must avoid contracting herpes, hiv, syphilis etc..).
Yes. Absolutely no problem unless you have been advised by your doctor not to. A condition called placenta previa may be a reason not to but your OB would inform you if you had it.