How pregnant are you right now? If you're 2 months, wait a while. If you're 5 months, you should tell them within the next month. With my first, I let my boss know when I was 10 weeks pregnant, mostly because I didn't want her thinking I was hung over at work. I looked awful, was really tired, and threw up constantly. Jumping up unexpectedly and running to the bathroom probably didn't look so great in meetings, you know? So she knew from very early on. With my second pregnancy, I worked for a company that was not very friendly toward women, and I waited to tell them until I was around 5 months. (Basically, when I couldn't hide it anymore.) I figured that 3-4 months was plenty of time for me to find a suitable temporary replacement for myself (I was the manager of a department). When I told my boss, I had come up with a plan (more or less) for handling my workload while I was gone, and dates (obviously subject to change if the baby came early, or whatever) that I would be gone on maternity leave. I expressed my willingness to be available via phone during my maternity leave, and my intention to return to work once my leave was over.
All that being said, employers are not technically allowed to discriminate based upon pregnancy, but we all know that they do. If you feel your employer isn't friendly toward new moms, then don't tell them until you have to.