Many sugar free sweets contain sweeteners like mannitol, xylitol or sorbitol or other sugar alcohols. They are also sweet, don't cause cavity and are low in calories because they're only partially absorbed by the small intestine. However, that allows them to reach the colon. Sorbitol is especially problematic it seems.
Since they are very osmotic, they draw water from the colon cells into the feces (instead of the other way round) , causing diarrhea. Bacteria in the colon are also happy to use those sugar alcohols as a source of energy, generating gas.
On a side note: You can treat obstipation with sorbitol and mannitol. It's a milder treatment than most plant drugs like buckthorn or senna.