How many months pregrant can you be to get on a plane and would it harm the baby?

Depends. A stable pregnancy can be on a plane usually until you're about 7 mo or so. If there are more issues, like diabetes, blood pressure, or risk of prematurity, that time can be set earlier by your ob. Flying itself doesn't harm the baby, it's more to do with the stress on you, and the risk of having the baby in a very inconvenient environment.