And so the beginning of the development of the QWERTY keyboard began. The design was not dictated by a sales department, or the limitations of the mechanics of the first typewriters. Instead, the design of the QWERTY keyboard was designed for Morse code, with significant regard given to putting the most frequently used letters on the home row.
The Morse code used in 19th century America was not the Morse code we know today. American Morse code is subtly different from the International Morse used today. American Morse encoded the letter ‘Y’ as (·· ··); two dits, a space, and two dits. ‘Z’ is encoded as (··· ·), and was commonly confused with ‘SE’, especially when appearing as the first letters of a word. Therefore, the ‘S’, ‘E’, and ‘Z’ keys should be close together. For the same reason, C – in Morse, (·· ·) – should be placed near both ‘S’, ‘I’, and ‘E’. There is a reason we don’t use American Morse anymore.
These efforts culminated in the typewriter that would grace the cover of the August 10, 1872 cover of Scientific American. For the first time, something resembling the modern QWERTY layout was available. It wasn’t perfect – ‘M’ wasn’t next to ‘N’, ‘C’ and ‘X’ were swapped. Characters, numerals, and punctuation were all over the keyboard, but this was what suited the telegraphers and became the basis of the first commercially successful typewriters. (Source)