Languages evolve continually, aided in part by migration and conquest. For example, the shift from Old English, spoken from the 5th to the 11th centuries, into Middle English, was precipitated by the Norman conquest of 1066, whereby Norman French became the language of the dominant class. These shifts can be understood as family trees, with each language family having a common ancestor. Most of the languages spoken across Europe, parts of the Middle East and India have a common linguistic ancestor: Proto-Indo-European. Portuguese, Persian and PunjabI are all related, if you go back far enough!
In fact there are probably fewer languages in common use today than there were, say, 400 years ago. Languages standardise over time, and this process is sped up by printed media and (later) TV/radio/film, as well as formal/compulsory education. Your observation that languages can hinder communication is essentially correct, hence the reaction against multiple languages.
For example, in 16th century France, not everyone spoke French. Breton was spoken in Brittany, and Occitan in the southern regions of Provence and Languedoc. In Spain at this time, Castilian, Catalan, Basque and Aragonese were spoken; whereas now the language we call 'Spanish' is more or less standardised Castilian.
The standardisation of language, and the erosion of dialects and non-dominant languages, was a key driver behind the development of nationalist movements in the 19th and early 20th centuries. The historian Benedict Anderson wrote about this process in 'Imagined Communities' (1983), arguing that the construct of the nation-state was built upon the idea of a shared language disseminated via print media.