This is taken directly from Heather's explanation of Soluble Fiber:
Why is soluble fiber so special? Because unlike any other food category, it soothes and regulates the digestive tract, stabilizes the intestinal contractions resulting from the gastrocolic reflex, and normalizes bowel function from either extreme. That's right – soluble fiber prevents and relieves BOTH diarrhea and constipation . Nothing else in the world will do this for you.
How is this possible? The "soluble" in soluble fiber means that it dissolves in water (though it is not digested). This allows it to absorb excess liquid in the colon, preventing diarrhea by forming a thick gel and adding a great deal of bulk as it passes intact through the gut. This gel (as opposed to a watery liquid) also keeps the GI muscles stretched gently around a full colon, giving those muscles something to easily "grip" during peristaltic contractions, thus preventing the rapid transit time and explosive bowel movements of diarrhea as well.
By the same token, the full gel-filled colon (as opposed to a colon tightly clenched around dry, hard, impacted stools) provides the same "grip" during the muscle waves of constipation sufferers, allowing for an easier and faster transit time, and the passage of the thick wet gel also effectively relieves constipation by softening and pushing through impacted fecal matter. If you can mentally picture your colon as a tube that is squeezing through matter via regular waves of contractions, it's easy to see how a colon filled with soluble fiber gel is beneficial for both sides of the IBS coin.