Just like with any other medication, there is always a risk when taking anything during pregnancy. You should always consult your OB/GYN before taking any kind of medication.
There have been very few cases of pregnant women exposing their unborn children to minoxidil. Due to the low number there is very little evidence supporting either its safety or dangers. With any drug you should be careful be particularly careful here as the risks are completely unknown.
Almost all drugs have the capacity to be dangerous to pregnant mothers and/or their unborn babies, including minoxidil. Contact your doctor to find out more, and to see if a better drug is available.