In Judaism, mentioning the name of G‑d is a big deal—as evidenced by the fact that the third of the Ten Commandments is "You shall not take the name of the L-rd, your G‑d, in vain." (Click here for more on G‑d's names.)
It is permitted to pronounce any of G‑d's names when in the context of a prayer, blessing, or when reciting a full passage from the Scriptures—as that is not considered "in vain." If, however, we mention His name inappropriately – for example, if we accidentally recite an incorrect blessing (the formula for every blessing includes His name) – we immediately say, "Baruch shem kevod malchuto l'olam va'ed." "Blessed be the Name of the glory of His kingdom for ever and ever."
In the Talmud we are told that after the High Priest (Kohen Gadol) recited the Ineffable Name, the people responded by reciting this formula. Evidently, this practice was based on an oral tradition, supported by a verse, "When I call out the name of the L-rd, ascribe greatness to our G‑d," as explained also in the Talmud.
From the phraseology in the Code of Jewish Law it appears that reciting this passage atones for having mentioned G‑d's name in vain, albeit inadvertently. But Maimonides implies that by reciting this verse we actually retroactively correct our misstep, because it turns out that although we mentioned His name, since we then praised it, we rendered our utterance acceptable, at least after the fact.
Rabbi Eliezer Danzinger for Chabad.org