The major partitions of the heart are completed by about day 37 of development.
Circulation through the fetus utilizes a number of shunts to bypass the pulmonary circuit as the lungs are filled with fluid and still developing. Oxygenation of the fetal blood occurs in the placenta.
These shunts include:
Oxygenated blood is carried to the fetus from the placenta by the umbilical vein. This blood is shunted through the liver by the ductus venosus and into the inferior vena cava.
As the inferior vena cava opens into the right atrium it is in alignment with the foramen ovale so that the blood mostly shunts past the right atrium through the foramen ovale and into the left atrium and left ventricle. This blood, which is 80% saturated with oxygen as it enters the fetus, does mix with small amounts of deoxygenated blood as it passes to and through the heart and the fetus.
At birth, once the newborn has taken its first breath, pressure in the left atrium becomes greater than that in the right atrium and the foramen ovale closes to become the fossa ovalis. Blood coming into the right atrium via the superior and inferior vena cavae can now only go into the right ventricle and into the pulmonary circulation. Upon oxygenation in the lungs, the blood returns to the left atrium and left ventricle for distribution to all the body tissues via the aorta.
Since the umbilical cord was cut, the umbilical vein is no longer needed and it becomes the ligamentum teres hepatis and the ductus venosus becomes the ligamentum venosum. The umbilical arteries also atrophy to become the medial umbilical ligaments. Within a few days post partum the ductus arteriosus obliterates to become the ligament arteriosum.