During breeding season ( generally Spring) the snakes are put together so they can do what comes natural for them that time of year , which is breed. This is only done if they are of proper age and size to breed. Snakes are not housed together because of many reasons, but one is breeding the female too early can cause problems and possibly kill her.
The snakes by instinct will try and breed earlier than what is good for them many times because the male just tends to go after it! Corn snakes are not known to eat each other so they are put together for short periods of time to do their thing and will generally take to each other, though some males are simply rejected by particular females and only the female knows why!
King snakes and milk snakes do eat other snakes so keepers are a little more watchful when they are put together to make sure they get along okay.
Hope this helps.
Dawn