Most doctors would say yes -- there's no good proof that the chemicals in hair dye cause birth defects, miscarriages, or any other pregnancy complications, and it's probably fine to dye your hair a couple of times during pregnancy.
That said, there are also no studies that confirm that these products are totally safe (after all, who would volunteer?), which is why experts recommend taking precautions like waiting until the second or third trimester -- when most of baby's major organs have finished forming -- and opting for vegetable dyes and semipermanent color (hues that wash out after about a month), which usually don't contain harsh chemicals like ammonia or peroxide. If you're still worried, consider getting highlights, which aren't applied directly to the scalp and are therefore less likely to be absorbed by your body. And if you're coloring your hair at home, remember to wear latex gloves to keep the chemicals off your skin. Don't leave the product on any longer than necessary.