We often want to go to the bathroom immediately after we drink coffee. The effect of coffee on our health has been studied repeatedly and it has been revealed that coffee is effective to prevent some diseases such as heart problem. But its effect on bowel movement has not been studied in detail, because it was not considered to be worth doing serious research.
Recent research has revealed that coffee doesn't work directly on colon, but stimulates the stomach to trigger nervous system or hormone response that leads to the contraction of colon. Coffee also speed up the time the food in stomach move to small intestine. Decaffeinated coffee has similar effects suggesting that compounds other than caffeine are responsible for immediate bowel movement.
But researchers recommend dietary fiber intake rather than relying on coffee to improve bowel movement.