The probable medical reason is pleural efflusion, caused by hypovolemic shock and congestive heart failure.
Hypovolemic shock, also called hemorrhagic shock, is a life-threatening condition that results when you lose more than 20 percent (one-fifth) of your body’s blood or fluid supply.
This would likely have been a result of the flogging prior to the crucifixion.
Those who were flogged would often go into hypovolemic shock, a term
that refers to low blood volume. In other words, the person would have
lost so much blood he would go into shock.
Prior to death, the sustained rapid heartbeat caused by hypovolemic
shock also causes fluid to gather in the sack around the heart and
around the lungs. This gathering of fluid in the membrane around the
heart is called pericardial effusion, and the fluid gathering around
the lungs is called pleural effusion. This explains why, after Jesus
died and a Roman soldier thrust a spear through Jesus’ side (probably
His right side, piercing both the lungs and the heart), blood and
water came from His side just as John recorded in his Gospel (John