Ever wonder why people smoke on the crapper?(other then to enhance the feedback of having your asshole stimulated

)
Your gastrointestinal tract is lined with acetylcholinergic receptors, stimulation of which are necessary for muscular contraction(for most muscle other then cardiac). Since most of the gastrointestinal tract consists of smooth muscle, that basically uses involuntary contractions (IIRC peristalsis). Nicotine binds to Nicotinic-ACh-RCRS thus promoting the mobilization of smooth muscular contractions like ACh itself.... thus you end up taking a shit...
Quitting smoking, in my experience, can give the same degree of prolonged and uncomfortable constipation as opiate use.
The effects of caffeine/coffee are also noted to be Laxative, but there is less agreement among scientists as to why.
If you are interested here is an abstract on the
Effect of coffee on distal colon function.:
http://gut.bmj.com/content/31/4/450.abstract
which supports that for some coffee works in this particular way, comparisons were conducted with caffeinated, decaffeinated, and just hot water.
As a side note
Coffee has a shit loads of compounds(most of the few that were studied showed to be carcinogenic

) many many unstudied compounds, so the mechanism unsurprisingly is yet unknown.