The formation of the atrial septum must preserve the fetal shunting of oxygenated blood from the IVC across the atria to the systemic circulation, while allowing conversion to the adult blood flow pattern at birth. The stages of septal formation are outlined below.
Septum primum grows downwards from atrial wall. The opening between the growth edge of the septum and the fused endocardial cushions is known as foramen primum. Blood from the inferior vena cava will flow across the atria, through foramen primum to the systemic circulation.

As growth progresses, foramen primum is reduced in diameter. Apoptosis in the upper portion of the septum begins.

The growth edge of septum primum now fuses to the endocardial cushion mass. Apoptosis in the superior aspect of septum primum forms a new opening, the foramen secundum. Any defect in the fusion of septum primum to the endocardial cushion is referred to as a patent foramen primum. These are usually slight and of no physiological importance.

The left valve of the sinus venosus begins growth downwards as septum secundum.

Growth and fusion of septum secundum to the endocardial cushions leaves an opening, the foramen ovale. The superior-most aspect of septum primum apoptoses, freeing this edge from the atrial wall. Septum primum now acts as a valve for the opening in septum secundum.

Seen in three dimensions (at approximately stage 4 above), only the atria have been shown in this perspective view for clarity.
The developing interatrial septae can be seen in a 3D tour (avi file, 760kb).
After birth, the pressures generated in the left atrium press septum primum against foramen ovale, sealing the collateral blood flow off and establishing the separate pulmonary and systemic adult circulations. The limbus of the fossa ovalis represents the edge of the septum secundum fused with the septum primum. Endocardial cushion fusion is the critical first step to proper interatrial septum formation: the central mass of fused endocardial cushions is the "scaffold" to which the growing septum primum and secundum will fuse. Absence or irregularities of growth, or the failure to close of either septum primum or secundum will also produce septal defects.