In most cases, heart problems cause pulmonary edema. But fluid can collect in the lungs for other reasons. These include pneumonia, contact with certain toxins, medications, trauma to the chest wall, and traveling to or exercising at high elevations.