Hi. I am so glad you asked this question because so many well-meaning people only cause more pain when they don't know what to say. It shows what a good friend you are that you want to say the right things and help.
I suffered through infertility too, lost two pregnancies(included a tubal pregnancy that nearly cost me my life), and counseled several friends that I met through my fertility process in their losses. Here's what I can say from my own experience:
1) Just say "I'm sorry." and "I'm here for you, whatever you need" a lot. Just knowing you are there and that you care will mean a ton. So many people, even close relatives, write off the loss of a pregnancy as no big deal. But it is a huge deal to the mother who lost that pregnancy. So it will help to know you care.
2) Avoid cliches like "It was meant to be" "It's better this way because the baby probably had problems." "You'll get pregnant again soon" etc. All these things are MEANT to help, I know, but they just make the mother's feelings invalidated.
3) Ask her her feelings and give her a chance to talk about it. It seems after a loss that no one really wants to hear you feel sad, especially your husband. So she might really need a listening, non-judging ear. Just listen and say you're sorry and it must be hard for her.
Good luck. You're a great friend!