"teh" is a typographical error of "the". It is not a misspelling because it is due entirely to lazy or clumsy fingers, rather than a lack of knowledge of how the word is spelled.

Like other phrases, such as "ZOMG", intarweb and the punctuation string !!1!, "teh" is meant to satirize people who are lazy and overly enthusiastic with their text production on the internet, especially on forums. Like many things in our overly-media aware culture, the satirization is many times more prevalent than the actual thing being satirized. While I occasionally see people actually make the error, and have even done so myself (if such a thing could be believed), it is almost always done self-consciously. In fact, it could almost be said that use of "teh" actually constitutes a type of straw man, setting a remark up as especially stupid. For example

Barko Bama is a Indonesan who wants too let teh Muslims into the US of A!
is meant to ridiculously overstate the attitude of a xenophobic person with the "teh" meant to highlight the laziness of the person's thought production.

"teh" is almost always used satirically, but it was obviously taken from a grain of truth. There are, after all, many lazy, overenthusiastic people out there on the internet. Where it was captured and crystallized can probably not be determined, although Jeff K.'s homepage on Somethingawful would probably be as good of a guess as any as to its origins.