There are many different types of computer microphones, but all of them work in the same basic way. Inside the microphone is a diaphragm, a screen which is sensitive to pressure waves. When you make a sound, it creates waves of pressure in the air, which push on the diaphragm. When the diaphragm moves, it produces an electric signal, which is sent to the computer sound card.
Video of the Day
The sound card takes the audio signal and turns it into a digital signal. It does this by taking many digital "snapshots" of the signal. The signal comes in as a wave. Thousands of times a second, the computer records the value of the sound wave as a number. Between all of the readings, it can make an extremely detailed picture of the sound wave.
When you are ready to listen to the recording, the computer converts the digital signal back into a sound wave. The computer takes all of those individual signals and creates an almost exact copy of the original sound wave. That copy is made into an electronic signal, which is sent to the computer speakers, which play the sound.