I upvoted @ssav and maybe I'm just saying the same thing in different words, but here's my take.
Sometimes when you are speaking, you accidentally or coincidentally use words that sound similar and that could be taken as a pun. If you're trying to be serious, when you do this you sometimes say, "Oh, no pun intended" to make clear that you were not trying to tell a joke, you are making a serious comment.
This issue is mostly limited to puns, as you rarely tell some other sort of joke by accident. I can easily imagine someone lecturing on coal mining saying, "Today we will discuss boring techniques. I don't want this to be boring so ... oh, no pun intended ..." and then go on with what he has to say. It would be very unlikely for someone to be discussing coal mining and say, "The first step in strip mining is to conduct a site survey. Like when a priest, a rabbi, and an atheist walk into a bar, and the priest says ... but oh wait, I didn't mean to tell a joke."
Not that it never happens. Occasionally a speaker will coincidentally say something that sounds like a well-known joke. If he catches it, he may stop and say, "oh, that sounds like a joke" or "that's not a joke". For example, I had a neighbor who raised chickens, and one day my kids and I noticed that one of her chickens had escaped from its pen. My daughter said, "We should tell her that one of her chickens crossed the road." Then she paused and added, "I think I've invented a joke."
The flip side is that if you did deliberately make a pun, and you think people might be taking you too seriously to notice it, you can say "pun intended" to make clear that it was deliberate. I think this is relatively rare because, as you say, explaining a joke usually ruins the humor. (Nothing destroys a joke like the speaker saying, "You get it? It's funny because you think the guy was talking about his car, but then when you hear the punch line you realize he was really talking about ..." etc. If the joke was funny, an explanation usually makes it cease to be funny.)
- Follow-on comment 4 years later
You say the question, "Whenever I read a carefully composed English text with a pun in it, the stated "pun" is ALWAYS followed by an explanation whether or not it was intended."
I'm not sure if you meant that literally or if that was a rhetorical exaggeration. But in English we certainly do not ALWAYS call attention to a pun. In fact doing so is pretty rare. You're just noticing the times that people did.