Ok - time for repeat of one of my mini-lectures!
Mostly constipation is caused by a lack of tone and muscle activity (known as peristalsis) in the large gut. So your period of fasting pre-op followed by the enforced fasting the day of surgery and probably one or two days after will be sufficient to result in an empty gut and low muscular activity. Low fluid intake in this period will exacerbate it as well for hard, dry stools will naturally be less bulky. Not rocket science thus far.
Then you add to it the muscle lethargy from the spinal or the general anaesthetic and the pain killers like paracetamol or codeine, and you're already ¾ the way to being severely bound up!
To correct it you can do two things -
~ take a bowel stimulant/laxative like Dulcolax or Senekot. Milk of Magnesia is a stimulant as well and castor oil, but milder than the other two.These can often give you cramps while the bowel is 'cranking up' ready to evacuate it's contents. Not nice.
~ or you can take bulking agents that go under names like Fibrogel or Benefibre which create plenty of substance in the gut and stimulates it into action in the most normal way. Bran as in breakfast cereals, fruit and vegetables can do much the same thing.
Prunes, figs and such are a kind of combination as the fresh or dried fruit will provide the bulk but the stuff itself is also a stimulant. It's all a matter of personal choice really. But I'd always recommend a bulking agent first in these situations. Much more natural and kinder to one's 'parts'.
As a matter of interest, prunes work so well because they are moistened with castor oil in storage. Thought you might like to know!