The first coding to enable long distance communication was Morse, which was developed by Samuel F.B Morse in 1844. This code is made up of dots and dashes (a sort of binary language...) and made it possible to communicate much faster than by Pony Express. The interpreter was the man of the time and he therefore needed good knowledge of the code...
Many codes were invented including Emile Baudot's code (bearing the code name Baudot, or Murray Code in English).
On 10th March 1876, Dr Graham Bell developed the telephone, a revolutionary invention which made it possible for voice information to circulate over metallic lines. As a matter of interest, the Chamber of representatives decided that the invention of the telephone was due to Antonio Meucci who in fact had lodged a patent request in 1871, but was unable to finance it beyond 1874.
These lines enabled the development of teleprinters, machines making it possible to code and decode characters using the Murray code (the characters were then coded over 5 bits, so there were only 32 characters...).
In the 60s, ASCII code (American Standard Code for Information Interchange) was adopted as standard. It allows the coding of characters over 8 bits, which is 256 possible characters.
A modem is a device used for transferring information between several computers (basically 2) via telephone lines. The computers operate digitally using binary language (a series of zeros and ones), but modems are analogue. The digital signals pass from one value to another, there is no middle or half way point, it's All or Nothing (one or zero). Conversely, analogue does not change "per step", it covers all the values, so you can have 0, 0.1, 0.2, 0.3 ...1.0 and all values in between.
For example, a piano works more or less digitally because there are no "steps" between notes. Conversely a violin can modulate its notes to pass through all possible frequencies.
So, the modem modulates digital information in analogue waves and in the reverse direction it transcribes analogue data into digital data.
This is why modem is an acronym of MOdulator/DEModulator.
A telephone line is designed to work with a telephone, which is why a modem is needed to establish communication with a remote computer using a telephone number before being able to exchange information. The language used by computers to communicate is called a protocol. The two most widely used protocols are: