The heart and circulatory system of a fetus begin to form soon after conception. By the end of the fifth week, the heart of the fetus is able to pump blood throughout its body. However, since the lungs will not function until birth when the newborn takes its first breath, the mother must supply the fetus with oxygen-rich blood. 

As in an adult heart, the prenatal heart develops four chambers and four valves.  But because the fetal lungs will not be used until after birth, blood must bypass the lungs. Two structures develop in the prenatal heart that allow the blood to be routed around the lungs: the foramen ovale and the ductus arteriosus. The foramen ovale is a hole that exists between the left and right atria. The ductus arteriosus is a blood vessel that connects the aorta to the pulmonary artery.

In normal prenatal circulation, oxygen-rich blood is delivered from the mother's body, through the placenta and umbilical cord, to the inferior vena cava of the fetus. The vena cava also receives oxygen-poor blood from the body of the fetus. Both oxygen-rich blood and oxygen-poor blood travel through the vena cava to the right atrium. 

Most of the mixed blood in the right atrium is pushed through the foramen ovale and into the left atrium. From there, it moves into the left ventricle, which pumps the blood into the aorta. The aorta then delivers the blood to the body of the fetus.

The remaining blood in the right atrium enters the right ventricle, which pumps it into the pulmonary artery, leading to the lungs. But since the lungs are not yet functioning, the blood is directed from the pulmonary artery through the ductus arteriosus, and into the aorta. Again, the aorta delivers the blood to the body of the fetus.

After birth, the foramen ovale and ductus arteriosus close as the baby begins to breathe. Oxygen-poor blood in the right side of the heart is now pumped through the pulmonary artery to the lungs. Oxygen-rich blood travels to the left side of the heart and is pumped through the aorta to the rest of the newborn's body.