I was raised with a very strict rule about this subject. If somebody tells you they are pregnant, congratulate them and be happy. But do not, under any circumstances whatsoever, tell anybody else. You just...don't do that. Not even if she posted on facebook when she was going off birth control and now is posting pictures of the blue stick. (Not that any of my FB friends have done this, but I have heard of it happening!)
You don't even do it after the person starts to show and it is an open topic of conversation. You can talk about it if someone else brings it up, but don't announce it to anyone yourself. But it is critical that during that first trimester, you keep your mouth shut. Absolutely shut. No exceptions.
Now, the original reason for this was a bit unscientific, I admit. In the area where my parents grew up, it was thought that you might "curse" or "jinx" the pregnancy if you talked about it too much too soon, and your chances of miscarriage would actually increase, beyond the ordinary rate of miscarriages, stillbirths, etc.
Obviously this isn't true. Your odds are your odds. And the people I know who follow the rule nowadays know that fully well. But they are still aware that miscarriages can happen, even in this day and age. You can't take a pregnancy for granted. And everybody that you tell that you are pregnant, you have to then explain what happened if a tragedy happens.
Which is why I think the other rule I was brought up with is also a good one, even today. If you are the one who is pregnant, until the first trimester passes (or after the "quickening" is another way I have heard it) don't tell anybody that you are pregnant that you would not want to know if you lose the pregnancy. Only tell people you don't mind "untelling".
It's wonderful, of course, that so many more pregnancies result in healthy babies than in the past, but I wish so many people wouldn't take that for granted.