God’s second commandment forbids “taking his name in vain” or “misusing his name.” Bible translations use both those phrases. “Misusing God’s name” might be easier for us to understand the intent of the commandment.
In the Bible, God has revealed his name for good purposes: that we might know him in faith, pray to him and share him with others. What God does not want us to do with his name is use it needlessly, without purpose, or wrongly.
So, a wrong use of God’s name is uttering it as an interjection when we are surprised or upset about something: “Oh, my God!” That is a common needless use of God’s name. Martin Luther’s explanation of the second commandment in his Catechism informs us that other misuses of God’s name involve cursing, swearing, lying, deceiving and witchcraft.
Luther reminds us from Scripture that God gave us his name to “call upon [it] in every trouble, pray, praise, and give thanks.”