Just be there for her. Hold when she needs to be held. A shoulder to cry on. Someone to scream at.
Many years ago, I lived in an apartment complex, and I was a little friendly with the couple next door. One day he came over and asked for my help. His g/f had just had a miscarriage and he did not know what to do for her. I went over there and she was hysterical. I held her for hours while she went through a range of emotions. About 1 AM, she finally went to sleep.
I would check on her over the next few days and she was dealing with OK, I guess. Several months later she came running up to my Apartment. She told me she was pregnant again, but this time the doctor had stitched a band around her cervix. Her cervix had fail with her last one. She later gave birth to the most beautiful daughter. I eventually moved on, but I saw that Mom and Baby every day till then. And it was such a pleasure to see her smile when she looked at her daughter.
Out of the bad will come good.