The bedding type is very important as Karen said, bedding which is not made out of natural materials can cause a rectal prolapse.

Also wet tail might be the cause. This is a disease which is often caused by stress, and young hamster are more prone to this. The cage which the hamster is being put into should be ready when the new hamster arrives, and the hamster should be left for about 2 days before being picked up etc, as the hamster needs to settle in to avoid stress. The main symptom is diarrhoea and wet tail usually kills the hamster within 2 days after the symptoms show if not treated. Symptoms usually take about 7 days to show.

If the hamsters had no signs of either of the things, all I would say is to clean and disinfect the cage before another hamster goes in it, and talk to the pet store.

Also how old are the hamsters? The hamsters should be at least 5-6weeks old.