Mutations just happen spontaneously over time. Since there are millions of ball pythons and they don't seem to spend a lot of time above ground during the day lots of color and pattern mutations have crept in. When they collect several 100,000 wild-bred balls a year (including eggs) they find a lot of these mutants.

All domestic Syrian hamsters appear to be descendent from a single wild litter found in 1930. There are now dozens of Syrian hamster mutations that have occurred in the many captive bred generations since 1930 (the mutations didn't start showing up for many generations).