It is not unusual for cats to roll in litterboxes. This behavior is generally a form of dust bathing and may help the cat scratch an itch. Some cats prefer to roll in particular types of litter or like to roll in their litter right after a litterbox is cleaned. If this behavior bothers the cat's owner, making changes to the litterbox and litter might stop the cat from rolling in litter.
Cats naturally dust bathe to replenish their body's stores of beneficial bacteria and to scratch itches that they can't easily reach. When an outdoor cat rolls in dirt, she covers herself in soil that contains beneficial digestive bacteria. She then grooms herself with her tongue and ingests these bacteria, which keep her body functioning well. A cat that is frequently bathed or brushed will instinctively dust bathe more often to replace bacteria removed by human grooming. Cats without access to the outdoors dust bathe wherever they can--usually in the litter box.
Cats have scent glands along the tail, on the sides of the head, on the chin, near their genitals and between their their front paws. When cats roll or rub up against objects, these glands deposit the cat's individual scent. This is a way of saying "Mine!" Some cats roll in their litterboxes to claim it as a favorite spot or possession using the scent glands all over their bodies. This is particularly likely in households with multiple cats competing for one litterbox. Getting several more litterboxes may stop the rolling.
If you don't like your cat to roll in his litter box, try changing the type of litter you use. Make this change gradually rather than suddenly, or you may find yourself with an angry cat who won't use the litter box at all. Change to a litter that is as different as possible from what your cat is currently using. If the box currently contains a fine, sandy litter, switch to a coarse clay or pellet litter and vice-versa. This may eliminate the rolling behavior by changing whatever trait originally attracted the cat to rolling in his litter.
Another strategy to eliminate rolling in litter boxes is to change the style of litterbox. Large, open litter boxes are most reliably used by cats, but they are also attractive dust bathing locations. Try a smaller, covered litter box to stop your cat from rolling in her litter. Place both boxes side by side for at least two weeks before taking away the old box in order to avoid accidents. If you use a covered litterbox, scoop it multiple times each day and change the litter frequently. Odors get trapped in covered boxes and cause cats to avoid them.
Rolling in a litterbox is not a harmful behavior so long as the box is kept clean. Cats will lick themselves many times each day, so if you just avoid petting your cat immediately after he has been in the box, you aren't likely to expose yourself to infection due to rolling behavior. Unless you really just can't stand the thought of your cat rolling in the litter box, this behavior should be ignored. Dust bathing and scent marking are natural and healthy behaviors.