There is no harm in wearing a piece of Lycra on your thighs, breasts or belly.
Your baby is safe inside your belly as it is surrounded by a cushion of fluids thus these things cannot harm your baby in any way but you might feel uncomfortable as your body is growing. Any serious harm can only be caused by any blunt force trauma like a collision but not by any uncomfortable undergarment. This will only result in you being uncomfortable and having reddish ridges on the areas where you wear it. Most Spanx producers now create maternity versions of the product also which will be more comfortable for you.