While he's in the uterus, your baby is practicing his breathing movements and this also aids his lung development. When he breathes in, the diaphragm moves downward and the chest wall moves inward.
Each "breath" the baby takes lasts less than a second. Breathing might only happen occasionally at this stage and when it does it can be either regular or irregular.
Your baby might also open his jaw and swallow at the same time as making a breathing movement. A single breathing movement with a large movement of the diaphragm may resemble a sigh.
For the chest wall movements to be effective, there must be adequate amniotic fluid (see You are 15 Weeks and 6 Days). This is especially true for the critical time of lung development, from 16-26 weeks.
By the 24th week of pregnancy, your baby will spend approximately three hours in a 24-hour period practicing breathing movements, and around eight hours in a 24-hour period in the last eight weeks of pregnancy.