Surfactant is made from amphipathic lipoproteins that have one hydrophilic phospholipid, or ‘water-loving” end, and one hydrophobic protein, or “water-repelling” end. This surfactant is critical for adequate ventilation.
In order to breathe, the alveoli must be inflated with inhalation and deflated with exhalation, which means there needs to be a balance in pressure and surface tension in order to inflate the alveoli. Surface tension is the strong attraction of water molecules on the outer surface to want to bind to each other. This is what causes beads of water to form on the side of a glass or plant. There is water within the lining of the alveoli and surface tension is constantly pulling on the alveoli to want to resist distension and cling together. While this force can aid in exhalation, this surface tension raises the pressure of the alveolar air and there is risk that surface tension could push the air out and cause the alveoli to collapse.
Additionally, some of the alveoli are larger and some are smaller. According to the Law of Laplace, the larger the vessel radius, the larger the wall tension required to withstand a given internal fluid pressure. In other words, the pressure is directly proportional to surface tension and inversely proportional to the radius of the alveolus. What this means for the lungs is that if the pull of the surface tension is the same, the large alveoli would have a lower internal pressure and smaller alveoli would have a higher internal pressure. Since air flows from a high to lower pressure – large alveoli would be at risk for over-inflating and small alveoli would be at risk for not being inflated at all and collapsing (called atelectasis).
When surfactant is added to the alveoli, it coats the fluid lining the alveoli and reduces the surface tension with inspiration. This surfactant is more concentrated in the smaller alveoli and the end result is that pressure equalizes between the large and small alveoli so that they can be inflated equally.
When a baby is born, their first breath depends upon surfactant being present in the lungs. During pregnancy at about 30-32 weeks gestation an increase in cortisol (a steroid hormone also known as hydrocortisone) in the fetus will stimulate the production of surfactant by the Type II pneumocytes. By 34-35 weeks gestation there is adequate surfactant naturally produced in the lungs to keep the alveoli from collapsing. If a baby is born prematurely it will not have had time to develop adequate levels of surfactant and may have significant difficulty with oxygenation and ventilation. This difficulty causes respiratory distress syndrome (RDS). Treatment for RDS includes using a ventilator to accomplish positive-pressure ventilation and provide surfactant replacement therapy where surfactant is administered through a breathing tube directly into the baby’s lungs. If there is concern that a mother will deliver an infant prematurely, she can be given corticosteroids during pregnancy to help to speed up the production of surfactant in the developing fetus.
Here is a very helpful video on surface tension and surfactant