A tracheoesophageal fistula (TEF) occurs when a connection between the trachea (windpipe) and esophagus (the tube that connects the throat to the stomach) forms during fetal development before birth.