Answer: To prevent Absorptive Atelectasis (Hunter Lung) due to breathing pure oxygen long term.
Not the reasons below (as suggested by previous answers)
Oxygen toxicity (correlates with O2 partial pressure, not total pressure)
Decompression sickness (made worse by nitrogen, not better)
Thermal convection (No thermal convection in microgravity)
Air cycling ?
Astronaut overheating ?
Biology experiments ?
Human outgassing (Farts are up to 90% swallowed nitrogen)
In the early 1950s, in UK aviation medicine, the condition of atelectasis (lung tissue collapse) was given the name "Hunter lung" due to its prevalence in pilots of the transonic fighter jet, the Hawker Hunter, which used a 100% oxygen supply.
Atelectasis also develops in 75–90% of people undergoing general anesthesia for a surgical procedure. (Atelectasis is due to the high concentration of oxygen in the anesthetic gas mix.)
— https://en.wikipedia.org/wiki/Atelectasis.
The cause of absorptive atelectasis is (a usually temporary) blockage of small airways by secretions. If the alveoli is filled with pure oxygen, the oxygen peripheral to the blockage is absorbed and that section of lung collapses. Surface tension acts to prevent re-expansion of those air sacs once the blockage is cleared. The longer high concentration of oxygen is breathed, the larger portion of the lung tissue suffers atelectasis. Hours (EVA) or days (Apollo) of pure oxygen are tolerated, but weeks or months (Skylab, ISS) would be problematic.
Alveoli are microscopic (200-500 microns) air sacs. Since they are wet, surface tension treats them like bubbles and “tries” to collapse them (see https://en.wikipedia.org/wiki/Pulmonary_surfactant). Usually, surface tension is opposed by surfactant effects or gas pressure. Otherwise, the tension would rise towards infinity as gas diffused out of the alveoli. Once alveoli have collapsed, this high surface tension prevents re-expansion.
Oxygen is very soluble in blood due to the carrying capacity of hemoglobin. If an alveoli’s airway is blocked, oxygen rapidly diffuses out of the alveoli into the blood and the alveoli collapses. Nitrogen is much less soluble in blood, so it remains in the alveoli and prevents it from collapsing. When secretions are cleared (like from a good cough), the alveoli re-expands with oxygen-containing air.
In Respiratory Medicine, nitrogen is sometimes referred to as "the skeleton of the lungs" since it prevents atelectasis.
Edit
Nitrogen is the most abundant gas in the atmosphere and in the lung. Unlike other gases in the lung, it reacts minimally with hemoglobin (Hb). As a result, it has slow alveolar uptake. This slow uptake helps to prevent loss of alveolar volume; replacing N2 with oxygen is a common cause of atelectasis (1).
— Marozkina NV, Gaston B. Nitrogen chemistry and lung physiology. Annu Rev Physiol. 2015;77:431-52. doi: 10.1146/annurev-physiol-021113-170352. PMID: 25668023.
Another Edit
Absorptive atelectasis is particularly common post anesthesia because many anesthetic gasses have high solubility in blood, as do oxygen and CO2. Nitrogen is deliberately purged from the anesthetic circuit because most anesthetic machines are closed-circuit rebreathers (like the ISS). The presence of nitrogen is potentially dangerous since it is possible for all other gasses in the circuit to be absorbed into the bloodstream, leaving the patient ventilated with pure nitrogen. As in a spaceship (where the same situation is possible), oxygen is constantly monitored and replaced.