It is safe if your doctor says so, but don't force it. We shouldn't do anything that causes injury or extra hospital visits because those checkups cost a lot nowadays.
If sitting on the floor in vajrasana is tough, try sitting on a yoga block or a thick pillow. It gives support and doesn't put pressure on your stomach.
I used to sit in vajrasana after dinner during my second trimester and it helped so much with acidity. Just make sure you don't strain your ankles or knees.
Please be very careful and ask your gynac first. I am always extra cautious about any posture or yoga during pregnancy because safety of the baby is everything.