Your womb baby is constantly getting oxygen and nutrients, yet he does not breathe in the same way as we do until the moment of birth. At 12 weeks of pregnancy the left and right lobes of the lungs are starting to grow and branch out with small contractions, not breathing air, but stimulating the chest muscles to develop.
Breathing movements can be seen as early as 15 weeks in utero. At this time, the respiratory system is not fully formed, but breathing itself is not necessary because the mother is supplying all the oxygen via the umbilical cord.
That is why your baby can develop and exist in a watery environment and even be born into water safely. The breathing movements are actually necessary to exercise the muscles of the lungs (they need a lot of practice) so that they can take on the lifelong job of breathing.
These movements stimulate lung growth and are a challenge because the lung sacs are filled with fluid, but this challenge helps to build strong muscles. During the second trimester, breathing movements increase and in the third trimester they become the most important exercise for your baby.