Pulmonary edema occurs when the air sacs (alveoli) in your lungs fill with fluid. The fluid buildup makes it hard for the lungs to do their job.