According to Prophet Muhammad SAW it is proved to offer Salah and do istighfar, Zikar and dua during solar eclipse but there is no specific instruction and prohibition regarding going out if pregnant ladies during solar eclipse. Therefore there is no sharai prohibition related to this issue. But if the doctor suggests it as a precautionary measure then there is no issue to act upon there instructions but this is not the order in shariah.
Therefore if someone wants to follow this for the medical reasons then there is space for it.
...................
References:
صحیح البخاری: (رقم الحدیث: 997، 354/1، ط: دار ابن کثير اليمامة)
إِنَّ الشَّمْسَ وَالْقَمَرَ آيَتَانِ مِنْ آيَاتِ ﷲِ لَا يَنْخَسِفَانِ لِمَوْتِ أَحَدٍ وَلَا لِحَيَاتِهِ فَإِذَا رَأَيْتُمْ ذَلِکَ فَادْعُوا ﷲَ وَکَبِّرُوا وَصَلُّوا وَتَصَدَّقُوا ثُمَّ قَالَ يَا أُمَّةَ مُحَمَّدٍ وَﷲِ مَا مِنْ أَحَدٍ أَغْيَرُ مِنَ ﷲِ أَنْ يَزْنِيَ عَبْدُهُ أَوْ تَزْنِيَ أَمَتُهُ يَا أُمَّةَ مُحَمَّدٍ وَﷲِ لَوْ تَعْلَمُونَ مَا أَعْلَمُ لَضَحِکْتُمْ قَلِيلًا وَلبَکَيْتُمْ کَثِيرًا
Allah knows best
Darulifta Al-ikhlas,karachi