In any audio communication, we first need the sound signal in the form of an electrical signal. Hence, we need the microphone in all our communication systems. It is the very first stage of any audio communication.
It acts as the (input) transducer for a system. A transducer is any device that converts a form of energy to another. The microphone converts a speech signal(sound energy) to an electrical signal(electrical energy). The function of a speaker is exactly the reverse of the microphone. The speaker is hence used as the output transducer to convert the electric signal back to a sound signal.
Now, this conversion of energy can be achieved by various means depending on the type of microphone. Largely, we can classify microphones as dynamic and condenser microphones. In either type, we have an element called the diaphragm(analogous to the biological diaphragm).
The diaphragm of the microphone vibrates when it is struck be the sound waves. This vibration is converted to an electric signal using either the principle of a capacitor storing energy as charge(the condenser microphone) or the principle of electromagnetic induction(dynamic microphones).
In condenser microphones, the diaphragm acts as a capacitor plate and when it vibrates back and forth, the distance between plates varies. Its like moving a capacitor plate back and forth with the incoming signal vibration. When the distance varies, the capacitance varies(since the capacitance is inversely proportional to the plate distance). This variation in the capacitance appears as variation in Voltage(C=Q/V but charge remains almost constant as the time frame for which the capacitance varies is very small). This variation in voltage is nothing but the desired electrical signal.
In a dynamic microphone, a coil is attached to the diaphragm.As the diaphragm vibrates, the coil moves back and forth. A permanent magnet produces a field that cuts the coil causing electric current to flow through it. This current signal is in accordance with the coil vibration-and hence the diaphragm vibration-and hence the speech signal. This is hence, the required electrical signal.