Beck started using this in the early 70's - they called it The Bag for a hot minute (as did Stevie Wonder) - Frampton's career came alive when he started using it - how does it work?
A talkbox is a small, self-contained amplifier and speaker assembly. There's a tiny little speaker in it and the speaker, instead of moving air in a room, moves the air in a plastic tube that it's sealed against. You run your guitar in to the talkbox and the plastic tube you insert in your mouth. So your mouth becomes a resonant cavity for the guitar sounds coming out of the tiny speaker.
You aim your mouth at a microphone, play your guitar, and by changing the shape of your mouth and the size of your open mouth, you can make it act like a filter on your guitar signal. Your mouth becomes the equalizer with far more degrees of freedom than something like a wah might offer.
Traditionally you'd "play" the talkbox in to a normal vocal mic and it'd be amplified at the front of the house just like your vocals. Because you're not using a tube amp or anything like that you'd run your guitar in to a fuzz pedal (like Frampton did when he Came Alive) or some such thing to dirty it up a bit (although the tiny speaker had a pretty good break up all on its own).
Rocktron has modernized the talkbox a bit with their Banshee 2 and they let you continue to feed your guitar signal to your guitar amp while playing the talkbox into the vocal mic to route to the front of house. But the speaker-driving-a-plastic-tube-to-your-mouth design has remained largely unchanged since it's inception.
When you talk into it you are transmitting sound(changing air pressure) into a microphone(essentially). This is used to modulate(or control in some way) another signal such as a guitar. It's based on the same principles as a vocoder(and essentially is one).
There are actually 2 basic types of "talkbox". The original one is exactly as explained in the first post. Basically, the amplified guitar signal is fed through a tube. The tube goes into your mouth, vibrating any dental work you may have (just kidding). When you move your mouth, the sound is changed, creating a vocal-type effect. This effect is amplified if you stand in front of a microphone (which of course must be attached to a working sound system).
The second - more recent - type of talkbox still uses a tube to "modulate" the sound, but the amplified guitar tone does not go through the tube and into your mouth. Therefore, it does not require a microphone. Instead, it works more like a vocoder, where you speak into the tube and the guitar sound is changed accordingly. I think that this is actually a vocoder that is being marketed as a talkbox, so the line does blur a bit here.