This was to insure that they not take God's name in vain. Where this substitution occurs in your English translations you will often see LORD spelled in all caps to indicate this. The Jews lived in awe of God. God was to be feared and reverenced as the most powerful being in the universe. By modern standards we have become quite irreverent in our attitudes and in our humor about sacred things.
Modern humor thinks that every subject is fair game for a laugh.
People should certainly be willing to laugh at themselves and never take themselves too seriously. But God is an entirely different matter. People and God are not the same. We are common and ordinary. We are from the dust of this earth.