I suggest having a talk with the teacher, assuming they are in school together. Some kids who talk about sex (or get pregnant at that age) are abused and it might be wise to have a third party deal with it. Likewise, it keeps some anonymity so that there is no tension between the girls. And less embarressment all around.
Only if you are friendly with them, then I might talk to the girl's parents. Don't assume anything about whether the girl is or is not pregnant. I would just say something matter-of fact like, you want to make sure they know she is saying this since she may say it to a lot of people like ministers, teachers, etc. And thought they should know so they can be prepared to field questions about it.
If it is not true, say you are glad to hear that and goodbye -not your business if their kid lies. Hopefully, they will take it seriously. But you do need to have a talk with your daughter re: sex, values, honesty, that becoming a parent is a big deal, etc.
And if it is true, tell them that you hope that everyone is doing well and to let you know if they need assistance. No judgement. Then have the same talk with your daughter as above, but stress the importance of friendship at difficult times and what the family must be going though.
Odds are they won't know anything about this and won't be able to tell you with certainty if it is true or not. And they don't have to - if it's the first they are hearing of such a thing, all they should say is thank you for letting us know and then go have a talk with their daughter.
Mainly, I think that you have to say something, because it will send a message to your daughter that having a baby is not a game and not something that you do to get yourself attention. I'll be curious to read the update and see what happens.