Is it safe to have eye surgery while pregnant?

Yes. Generally, unless it's an emergency, like a retinal detachment or lacerated cornea, most eye sugery is best postponed to the postpartum period.
Usually. Most eye surgery is done under local anesthesia and there no risk to the developing child from this. If you have concerns discuss with your OB and your ophthalmologist. And - could it be put off until after delivery?