A codec is a "black box", either software or hardware, which takes in encoded data and produces decoded data, or vice versa. As Pedro suggests, the most common use is in multimedia, both for audio and video.
A typical example is an MP3 software codec. To play an MP3, your player passes MP3 data as a parameter to a decode function. The return value is (a pointer to) raw samples suitable for playing.
To encode a file into MP3 format, the encoding program passes samples to an encode function, which returns (a pointer to) the encoded data.
Codecs usually have various configuration parameters which can be set by the user, such as compression/quality tradeoffs or CPU usage.
In the ideal world, which is approached by Windows' ACM system for audio codecs (the video codecs work in a similar fashion, but without a snazzy acronym), each format's codec would have a common interface. When a codec is installed, any application could then use any available codec suitable for the stream type (e.g. audio, video).