Codec stands for "Compression - Decompression" or "Coder - Decoder". Most of the time, it refers to an algorithm, but sometimes the term is used to describe a device that performs these two tasks.
Often the purpose of a codec is to reduce the quantity of data needed to transmit a digital signal by encoding it in a different (compressed) way. Sometimes the codec only refers to encoding and decoding data while no compression involved. Codec can be used for any kind of signal. However, images, audio, video and logical are the most common signals.
If compression is involved there are two main families of codecs: lossless and lossy. A lossless codec creates no alteration of the signal: after decompression, it is exactly the same as before compression. The advantage is an absolute fidelity to the origin, but it requires more bandwidth. Reversely, a lossy codec has a higher rate of compression but part of the signal can be lost. This is not always an issue. Most audio codecs are lossy but when the sound is rendered through loudspeakers, the human ear and brain cannot tell the difference.