The heart is the first organ to become fully functional and is delivering oxygenated blood flow to the fetus within the first few weeks of life.
(Please see my posts on embryology and morphology to fully understand this subject)
Since the fetus does not breathe nor eat and therefore cannot produce its own oxygen and nutrient supply, it depends upon the mother for these essential functions. Â The placenta is the intermediate organ between the mother and the fetus that provides both nutrients and oxygenated blood flow to the fetus, as well as disposes of de-oxygenated blood flow returning from the fetus.
It is important to remember that the fetal lungs do not function until after birth; the placenta provides these vital functions. The growing fetus does not require fully oxygenated blood flow in its growing state, for example SaO2 levels of 99%. Instead, it can survive quite well on SaO2 levels that are in the 70-85% range and do quite well. This is why fetuses with complex congenital heart defects most often survive until birth.
Once born, and the fetus must depend upon its own circulatory supply, do complex congenital heart defects become critically important.
Fetal circulation is a bit complex and difficult to understand. The physiologic rule that all arterial blood flows away from the heart, and all venous blood flows to the heart gets a little backwards in this case.
The placenta provides three vessels to the fetus that make up the umbilical cord: one umbilical vein, and two umbilical arteries. The placenta collects highly oxygenated blood from the mother and transfers this blood flow to the fetus via the umbilical vein, drains into the vena caval circulation and returns to the fetal heart via the right atrium and right ventricle.
This highly oxygenated blood enters the right heart and is diverted away from the fetal lungs through the two naturally occurring holes between the right and left heart, the PFO (patent foramen ovale), and the PDA (patent ductus arteriosis). These normally occurring fetal right-to-left shunts direct blood flow to the left side of the heart where it is delivered primarily to the upper portion of the fetus, the head and upper body. These are the most important structures at this level of development, especially the brain.
As blood flows through the rest of the circulatory system  it tends to de-satuarate as it travels to more inferior structures, such as the kidneys and the lower extremities.
The umbilical arteries attach to the internal illiac arteries in the fetus, and serve to carry more de-saturated blood flow from the fetus back to the placenta, where it will be cleaned and re-saturated for return to the placenta.
I realize that the umbilical vein carries oxygenated blood to the fetus, and the umbilical arteries carry de-oxygenated fetal blood flow back to the placenta. This can be quite confusing, but this is the way fetal circulation happens.
The area of the PFO and the surrounding structure or the right atrium is a “folded” type of crest that naturally causes blood to flow from the right atrium into the left atrium until after birth when this structure should naturally close.
If a neonate reaches normal gestation of 40 weeks, the PDA tends to be “programmed” to close at this point. Premature neonates tend to have a PDA that stays open. This will cause (after birth) blood to flood the right side of the heart and hence deteriorate SaO2 levels.
Very often the PDA will need to be closed surgically with a minimally invasive procedure that ligates this opening. This procedure is often done bedside, and corrects the problem of over-circulation of the lungs.