This was awful in my last pregnancy to the point my midwife said she reckoned it slowed my labour down! I didn't even poo during labour.
I really want to try and get on top it this pregnancy (14 weeks currently)
Things I've do currently:
lots of fruit and veg, lots of water
walking or yoga every day
no straining
giving myself plenty of time on the loo (even if toddler is destroying the bathroom while i do)
a friend recommended linseed so I've been having a spoonful of this every morning
I do eat prunes a lot of the time (yuk)
I just went and got some lactulose from the pharmacy, they said this was the only thing I could have in pregnancy. Any other tips? 
I'm even wondering about asking my midwife for an enema before labour, like they used to. Do you think they would let me have one?