It is common knowledge that bananas are good for relieving constipation, and eating them when you have irregular bowel movements can help promote bowel movements. In fact, not all bananas have this effect; only ripe bananas do. Eating too many unripe bananas will not only fail to relieve constipation but can actually worsen it.
Dr. Wei Fei from the Institute of Materia Medica, Chinese Academy of Medical Sciences, explains that bananas are rich in dietary fiber, a large portion of which is not digested or absorbed but can increase the volume of stool and promote intestinal peristalsis. At the same time, bananas contain over 15% sugar and a large amount of water-soluble plant fiber, which can trigger the secretion of hyperosmotic gastrointestinal fluids. This, in turn, draws moisture to the solid parts of the stool, making it softer and easier to pass. [China Food]
However, these effects are only present in ripe bananas; unripe ones can have the opposite effect. Besides being green and unripe, some bananas may look yellow on the outside but have a firm, even slightly astringent, flesh. These bananas are also not fully ripe. They contain a significant amount of tannic acid, which acts like the barium used in barium enemas. It is difficult to dissolve and has an astringent effect on the digestive tract, inhibiting the secretion of gastrointestinal fluids and their peristalsis. Consuming too many can lead to or worsen constipation. Therefore, unripe bananas should not be used to relieve constipation.