OK don't let it dry out - put it in a small plastic tub with fairly wet paper towel on the bottom. Some people recommend concentrated sugar solution, but I would recommend packing the area with castor sugar. This draws fluid out of the swollen area and usually allows it to be drawn back into the body cavity. Once you apply the sugar, keep handling to a minimum.
Reasons why it happens are varied and unsure. Perhaps a bit dehydrated, straining when passing a crap etc...
The most important thing is NOT TO LET IT DRY OUT. If it persists after a day or two, you can get a herp-specialist vet to return the part of the bowel to where it belongs and put a suture (stitch) in to hold it in place until it heals normally. Looks awful, but it's not usually an urgent problem, as long as the tissue doesn't dry out.
Jamie