Due to the way their digestive system is set up, hamsters do not get all the nutrients they need the first time the food passes through their system. So once it comes out in poop form, they eat it again to receive the nutrients their bodies did not absorb the first time.
Although it does seem odd to us humans, it is very normal for not only hamsters but also some other animals to eat their own poop (rabbits do this too!)
Hamsters do not eat all of their poop though, only the ones that can get additional nutrition from. The other type — the ones that you see all the time in your hamster’s cage — is passed out and not eaten.
This coprophagic behavior most often occurs at night and the hamster eats the poop almost immediately when it is passed out. Most owners do not even know that their hamsters do this.
I’ve only seen it once or twice in a few of my hamsters although I’m sure it happens a lot more. Have you seen your hamster eat its poop?