It helps to have separation. Either physicial of cultural. American English was well on the way to becoming a different language from British before WW1.
Many colonies are settled by people speaking a nonstandard form of the national language and often the colonials miss out on some of the language changes at home. They often have their own changes which do not make it home.
Well yeh, but as I said, with the entire world colonized by four or five countries, we still only have one example of a separate "colonial" language actually forming. But again, linguistic classification is, at the end of the day, political. Afrikaans is closer to Dutch than Moroccan Arabic is to Modern Standard Arabic, though the former is considered a separate language, while the latter is not, merely out of political purposes.
Another way is to have different Ethinic Groups who speak the same language go out of there way to make their dialect as different from the others as possible. Look at Hindi and Urdu or for a current example look at
Bosnian, Croat and Serbian.
They didn't so much "go out of their way" to do it, rather your examples are all based in languages that have multiple orthographic systems, which formed the basis of divergence. Urdu is Hindi written through the Arabic script (but it also has a great deal of loan words from Arabic and Farsi, thanks to geography and shared religion), while the Serb/Croat languages are written with the Cyrillic/Roman alphabets respectively (Bosnian is this weirdo free-for-all language that has been written in Cyrillic, Roman script and Arabic script at different parts in their history, while the nobility primarily used Arabic or Turkish speech.)
A cool fact as to why Spanish and Portuguese are different is that the areas that speak Spanish today retained more of the "Moz-Arabic", or Middle-Spanish written through the Arabic script and also kept some grammatical influences, while Portuguese retained less and is more alike to French and Occitan in grammar and phonetics, if not vocabulary.