At face value, the phrase “no pun intended” is to demonstrate that the preceding words were meant to be sincere, not as a pun. A pun is a form of word play, in which a word or phrase could have two or more meanings. For instance, you could say, “The cake decorator seemed very sweet. No pun intended.” The addition of “no pun intended” shows that you genuinely thought the cake decorator was sweet, as in pleasant and kind, not that you were poking fun at his occupation with your choice of words. In writing, some people are of the opinion that the potentially confusing sentence should just be rewritten, and then the phrase will be unnecessary. Others think it’s innocuous enough as long as it isn’t overused. In speech, it should be used at the speaker’s discretion; sometimes the addition will only draw more attention to the ambiguous wording rather than providing clarification.
The other possibility is that the phrase is being used tongue in cheek, and the sentence in question is indeed an intentional pun. In these situations, the speaker or author is actually drawing extra attention to the pun that was just made. However, it is often not clear if the phrase is being used sincerely or jokingly, especially in writing. Sometimes the phrase is varied when this is the intent, such as “no pun intended?” or simply “pun intended.” Generally these (or no follow up statement at all) are more appropriate if the pun is intentional.