It implies that the person speaking is not thinking clearly, is not making sense, or is simply saying things that are not true or logical.
The phrase likely originated from the idea that someone talking through a hat would be muffled and difficult to understand, making their words seem nonsensical.
Here are some examples of how the idiom might be used:
* "She was talking through her hat when she claimed she could fly a plane."
* "Don't listen to him; he's just talking through his hat."
* "That theory is so outlandish, he must have been talking through his hat."