A: it's a file format
B: it's an encryption method
C: it's a format converter
D: it's a little wizard that lives in 3.5mm holes
The answer is actually all of the above, depending on the situation. In all cases it COdes and DECodes audio from one format to another. Sometimes so that the bandwidth/storage size is small but the sound quality is high. Other times it's to convert from a format electronics can understand (1's and 0's) to one our ears can (analog waves).
In software, an audio codec is associated with the familiar MP3, AAC, OGG file extensions that store compressed audio on a hard drive or flash card, or stream it to/from a remote location. This type of codec often concerns itself with compression, saving storage space or bandwidth. The codec is typically a software library, and different codecs optimize for different levels of fidelity, compression, and computational complexity.
A hardware codec is typically an IC that handles converting analog audio between an analog waveform and a digital signal. Sampling rate and bit depth control the signal fidelity, and usually the signal is not compressed at this stage (though it can be). The digital output of a hardware codec is usually a hardware bus like I2S, I2C, SPI, or AC-Link.
We tested a few different codecs and ended up with a system that looks like this:
ES8316 from Everest Semiconductor:
Bought this on a pre-made dev board and never got it to reply to us. We think the little wizard died.
WM8731 from Wolfson Microelectronics:
Also on a pre-made dev board. This one works, but doesn't have a driver for an external speaker.
WM8750BL, also from Wolfson:
We had to make a custom PCB to try this one. It's more complex to control (lots of registers), but has mic in, headphone out, and speaker driver, which completely solves our analog sound requirements. Currently it's running on a separate dev board. There are some noise issues that are most likely related to not separating digital and analog ground planes, but it seems to be functioning well otherwise.