This is rough... exact same thing happened to some friends of ours a couple of months ago... they tried for 7 years or so to get pregnant... it ended up happening finally and they were pregnant just 2 weeks after my wife and I... morning of their scheduled c-section something went wrong and they lost the baby...
there's no easy way to go through something like this but our friends are doing quite well by the grace of God... God's using the situation to grow their faith and change their lives for Him... I'll definitely be praying for you and your wife as well as your friends and the entire situation in general...
And we know that in all things God works for the good of those who love him, who have been called according to his purpose. - Romans 8:28