A non sequitur occurs when a reply or conclusion has no relevance whatever to the original topic. The term comes from Latin, and means 'it does not follow'. When used in humour or comedy, they work best when unexpected, and they can be used to create an off-beat, surreal tone.
Non sequitur jokes are often lumped together with more general surrealisms.
The most obvious examples are jokes that centre on one party mishearing or misinterpreting what was said by another, but many other examples can be found. There are a few jokes on BadPuns.com that fall into the category, though they are not the main focus of the site.