Anusol is your friend. Not sure about prevention - maybe eat lots of fruit to ensure there is no...um...straining . A friend had a Piles Prevention Plan (PPP) which included lots of fruit, water and fibre, but wound up with piles post-partum anyway.
I found one post-partum, and it may have been there earlier but I didn't realise. It deflated very quickly - I asked the doctor to check on it at the 6 week check and she said it was gone, even though you can still see it. Apparently they don't vanish completely, just deflate.