Evolution isn't need-based. It’s just a matter of gradual changes over time. Whatever survives passes on its genetic material, while whatever dies before it can reproduce does not. Animals do not migrate successfully to hostile environments - rather, the environment may change, giving the animal a chance to expand, or natural selection may favor certain traits, such as upright posture or a large brain.
Evolution doesn't take millions of years. It does occur over millions of years, but new species can form through genetic drift in less than one hundred years. Take the mosquitoes in subways in England for example. They are descended from mosquitoes which first inhabited the subways when they were first built. After a few decades, they were no longer able to breed with mosquitoes from outside the subway.