The Zika virus, known for its potential to induce neurological conditions such as microcephaly when transmitted vertically from infected mothers to infants, has sparked widespread concerns globally. Motivated by this, we propose an optimal control problem for the prevention of vertical Zika transmission. The novelty of this study lies in its consideration of time-dependent control functions, namely, insecticide spraying and personal protective measures taken to safeguard pregnant women from infected mosquitoes. New results provide a way to minimize the number of infected pregnant women through the implementation of control strategies while simultaneously reducing both the associated costs of control measures and the mosquito population, resulting in a decline in microcephaly cases.