The chambers of the heart form before the child is born. Before birth the infantile circulation must pass through the placenta of the mother, as the infant is not yet breathing. As the time of childbirth nears, the infantile circulation prepares for the outside world by slowly closing the connections to the mother that include the ductus arteriosus (if it remains open after childbirth it is called patent ductus arteriosus) and the atrial septum. The atrial septum divides the right and left atrium. This septum is made up of a curtain like segment of tissue that slides together gradually. If these "curtains" don't fully close, at an area that we call the foramen ovale (oval window), this is called a patent foramen ovale. Through a hole such as this, it is postulated that a blood clot from a vein in the leg or pelvis could potentially pass from the right to the left atrium and then to the brain causing a stroke (in the absence of such a hole, the clot could never go to the left side and to the brain but could only go to the lungs causing a pulmonary embolus). In order for this to happen of course, you would first need the blood clot, and second, there would need to be an increased pressure in the right side of the heart (the left side almost always has higher pressure). In certain circumstances, such as during a bowel movement, a stroke could occur.
There have recently been several observational studies (in other words a study that looks at what the authors have observed and is not controlled or randomized) that have suggested that when a person is found to have a PFO after a stroke closure by a non-invasive device would prevent such strokes. This is similar to clipping the curtains together. Despite several high profile cases that have been reported (one in my region of the country: football player Tedy Bruschi), there is really no good scientific proof (actual controlled, randomized studies) to back up this theory.
We don't actually have any proof that closing a small patent foramen ovale will reduce the long-term risk of stroke. Since the devices now being used have not been available for very long, it is doubtful that any proof will be available for the next few years. We are already hearing more about late device failures. The long-term risks from non-invasive closure will not be as good as surgery (during surgery the hole is viewed directly, during non-invasive closures the views are indirect). Fortunately, despite the absence of any scientific proof that closing or leaving a PFO alone found after stroke, the outlook remains good for the patient in that the recurrent stroke rate after an initial event remains quite low.
Closing larger holes surgically (called atrial septal defects) does prevent the development of cardiac problems such as chamber enlargement, atrial arrhythmias, and pulmonary hypertension and may prevent strokes over several decades. These holes are usually found in the first few years of life and the standard of care is to close them if they are sufficiently large as to be expected to cause problems in the future. We use complex calculation to determine this and have never observed sufficient benefit to closing the hole if it is small. Doctors who want to implant devices "non-invasively" with the help of catheters feel that they may be used to close smaller holes without the "risks" and discomforts known to occur with surgery. The risk however of this type of surgery is negligible (I haven't seen or heard of a death from repair of an atrial septal defect in three decades), and the long-term results are superb. The long-term risks from non-invasive closure will not be as good (during surgery the hole is viewed directly, during the other closures the views are indirect).