Pulse Code modulation as a method to digitize sound has been proposed by Alec Reeves in 1937. It had to wait until the transistor and the IC become available at low cost before this method was successfully introduced in the consumers market. Almost all of today's digital audio is PCM audio.
The principle is simple; the analogue signal is measured at fixed intervals, the sample rate. The magnitude of the signal is translated into a numeric value represented in bits.
In principle, any digitized analog stream can be and fully reconstructed as long as the sample rate is the double of the highest frequency in the analog input. This is the famous Shannon-Nyquist sampling theorem.
In audio, the digitizing is done using an AD (Analog to Digital) converter.
For playback the reverse is needed, converting the digital file back to analog. This is done by a DAC , a Digital to Analog Converter.
More about sampling can be found here.