Unless it's a serious heart defect, the chances of it being detected in the womb are slim to none. After birth, or in adulthood however it is very easy. At most times, when a doctor is listening to a patients heart, he/she will hear a slight murmur, that isn't normal. So with further checking the doctor will be able to diagnose how serious the defect is, and how they will treat it.
Unless it's a serious heart defect, the chances of it being detected in the womb are slim to none. After birth, or in adulthood however it is very easy. At most times, when a doctor is listening to a patients heart, he/she will hear a slight murmur, that isn't normal. So with further checking the doctor will be able to diagnose how serious the defect is, and how they will treat it.