Those 6 words are enough to express your sympathy to a friend who just a miscarriage.
I never quite knew what to say when meeting friends who lost their family members, let alone pregnancy. I became a mumbling fool near them because I'm afraid I'll say inappropriate things that might hurt them even more. Until an unfortunate thing happened, I had a miscarriage and had to face all sorts of comments from well-meaning friends and family that taught me one valuable lesson. You don't have to say too much. Just say how sorry you are for their loss.
Moreover, the following is what NOT to say to a woman who just had a miscarriage:
"Makanya jangan kecapean / Terlalu ngoyo kerjanya / Pake hak tinggi / Jalannya terlalu cepet"
(true story, someone actually said it to me) or any remarks that are basically saying that the mother did something that caused the miscarriage.
Most miscarriages happen because the fetus may have been unable to implant in the uterus, or implanted poorly; it may have suffered from a genetic aberration; there may have been significant chromosomal abnormalities that weren't compatible with life. Whatever the cause, the result was that the embryo or fetus was unable to develop normally. And it is not the mother's fault.
"Untung baru 2 bulan ya"
Whether it happens during the first, second or third months, it is still a great loss for the parents and most probably they have begun to bond with their baby. So yes, comments like that will hurt.
"Nanti juga dapet lagi"
That may be true but saying this give the impression that you take the parents' grief lightly.
"Untung udah punya anak ya"
Yes, but they have lost THIS baby and you can't just replace a baby with a new or existing ones.
There are many more examples of remarks intended to cheer up a grieving mother but end up making her feel more depressed, but the above are the ones I heard the most. I, of course, didn't show any emotion when dealing with this kind of remarks but I did wish they hadn't said them. And when I heard those things said to another grieving mothers, I wince.
So once again, keep it simple but let her know that you are there for her if she needs to talk. And one more thing, if you work in the same place, it might be a good idea to tell your colleagues that your friend just lost her baby so that when she returns to work, any awkward situation can be avoided. Learn from my experience. When I came to the office after my miscarriage, somebody in the office ran to me and said in a loud voice "Hi there pregnant mama! How big is the baby in your belly now?" while stroking my tummy lovingly. When somebody told her what happened, her face went bright red and she couldn't look me in the eyes for weeks after :D Believe me it was awkward for both of us!