Oh, I am so sorry for your friend. What a precious friend you must be to her. I have had 2 miscarriages this past year. So hard. I was about the same place in my pregnancy as your friend. Just let her know you are sorry, and that you love her. Be free with hugs, if she likes hugs. Bring her a meal for her family. Offer to take her other children/daughter for a few hours. Grieve with her. In a week or two, ask her how she is doing. Encourage her that this pregnancy wasn't for nothing. She birthed a living soul for all eternity. What a wonderful thing for a woman to be able to do. Incredible, really. If you have an opportunity, encourage her to keep the name for the baby. I find that having names for my babies that have died is so helpful. They are real babies, just smaller than most.
Blessings to you as you minister to your friend.