The husband should recite Ya Mubadiu Ya Allah- 99 times placing his finger tip on the stomach of his pregnant wife, just before the fajr Azaan( Morning Prayer) on any day during the initial stages of the pregnancy. Mubadi means the one who begins the creation.This dua not only avoids miscarriage but also prevents the premature birth of the child.
EDITED:
Just thought of sharing my experience with this dua.
I am a mother of 4 kids, 3 of them are in this world and one is in the next. When I was pregnant with my 3rd child my husband went out of town even before we came to know that i was pregnant, so this child survived only for 8 weeks in my womb after which it stopped growing for no reason and then there was a miscarriage in the 11th week. The above dua was recited for all my pregnancies except this one.
I do not have any hadith to support this dua, i had seen this dua in one of my dua's books and it has worked for me so far. And Allah knows the best.