A chest x-ray may be done if your health care provider thinks you may have an underlying health condition that affects the lungs or heart, such as pneumonia.