In the old Slavic languages, the sound [o] could never follow the palatalized consonants (which in those times also included the hushing consonants Ш [ʃ], Ж [ʒ], Ч [tʃ], Щ [ʃtʲ], and also Ц [tsʲ]), since in the Proto-Slavic language [o] in this position had changed into [e].
In the 12th-16th centuries in the Russian language, the pronunciation of the stressed vowel sound denoted by the letter E changed (consonants before E were palatalized): the stressed sound [e] changed into [o] when before non-palatalized consonants and at the end of a word. This Е underwent no change before Ц (at the time when this law was active, Ц was still a palatalized consonant), and before some consonant clusters (первый, верх, женский - at the time when this law was active, the first consonant in those clusters was palatalized). Sometimes the sound [o] appeared between palatalized consonants, mostly by morphological analogy (о клёне [ə 'klʲonʲe] - similar to клён [klʲon], клёна [klʲonə], etc.; the verbs ending -ёте - similar to -ёт, -ём, the Instrumental case ending -ёю/-ёй - similar to -ою/-ой). The Church Slavonic language and the Church Slavonic borrowings in Russian were not subjected to this law, neither were the borrowings that came into the Russian language later. The sound represented by the letter yat', Ѣ, with rare exceptions, did not change into [o].
When this new [o] after the palatalized consonants appeared, there were no orthographic means to write it and to indicate the palatalization of the previous consonant, it was usually spelled as IO, sometimes as ЬО. In the last decade of the 18th century, the letter Ё was introduced, but until now, until the 21st century, the usage of this letter is not obligatory, if you wish, you can write it, if you wish, you can write E instead. This spelling inconsistency affected the pronunciation of some words, mostly personal and geographic names, and also some borrowed common nouns. For example, the original name of Leo Tolstoy was Лёв [lʲof], but since it almost always was written as Лeв, its wrong pronunciation as [lʲef] gradually became the dominating one. The opposite also often happened: the words where E should be written and [ʲe] should be pronounced, are mistakingly read with [ʲo], as if Ё is there: some mistakingly pronounce афёра instead of афера, or гренадёр instead of гренадер. The same happened with мушкетёр (from French 'mousquetier') and фуникулёр (from French 'funiculaire'), but here the originally wrong pronunciation is now considered to be standard. In the case of шофёр, the word comes from the French 'chauffeur' [ʃofœr], and the sounds [œ] and [ø] usually written as ö are often spelled as Ё in Russian, all the rules of using Ё in the foreign names and borrowings are very many and very complicated to enumerate them here.