Most airlines won't let passengers on board after 36 weeks. As a doctor, I agree that anything up to 36 weeks is fine. I simply tell my patients to be sure and drink lots of water, and get up every hour or two and make a couple of laps around the plane to get your blood flowing (this helps reduce the risk of blood clots).
However, if you have any sort of pregnancy complications, have had any he contractions, are at risk for pre-term labor, or have a history of delivering early, your doctor may recommend that you not fly in the later weeks of pregnancy. If you are pregnant with multiples, you may want to hold off too — if a patient is having triplets, I recommend that they not fly after 20-24 weeks.