Don't Take Hashem's Name in Vain: The third commandment
(ז) לֹ֥א תִשָּׂ֛א אֶת־שֵֽׁם־יְהוָ֥ה אֱלֹהֶ֖יךָ לַשָּׁ֑וְא כִּ֣י לֹ֤א יְנַקֶּה֙ יְהוָ֔ה אֵ֛ת אֲשֶׁר־יִשָּׂ֥א אֶת־שְׁמ֖וֹ לַשָּֽׁוְא׃ (פ)
(7) You shall not swear falsely by the name of the LORD your God; for the LORD will not clear one who swears falsely by His name.

Some people translate this as, "You shall not take the name of God, your God, in vain, for God will not absolve anyone who takes His name in vain."

(א) לשוא. חִנָּם, לַהֶבֶל, וְאֵיזֶהוּ שְׁבוּעַת שָוְא? נִשְׁבַּע לְשַׁנּוֹת אֶת הַיָּדוּעַ – עַל עַמּוּד שֶׁל אֶבֶן שֶׁהוּא שֶׁל זָהָב (שבועות כ"ט):

(1) לשוא IN VAIN — for no valid reason, idly. What is a שבועת שוא, an oath taken for no valid reason? If one takes an oath declaring something, the nature of which is evident, to be different from what it is: e. g., swearing about a stone pillar that it is of gold (Shevuot 29a).

כוונת רש"י, שלא תאמר שלשון התרגום למגנא שהיא חנם, ר"ל שאין בו הנאה, אבל אם היה לו בו הנאה יהא מותר, לכן פירש להבל, דעיקר הכוונה להבל שאין בו ממש, זה נקרא חנם. [גור אריה]. ועיין בשבועות (כט.) שם תמצא ד' מיני שבועות שוא:

Siftei Chachamim:

Rashi is commenting on the Onkelos, who translates the word "למגנא" to mean "not deriving any benefit". This would imply that if you do derive benefit from it, you would be allow to use Hashem's name. That is why Rashi explains that this is talking about meaningless oaths.

(א) לא תשא בשבועת האלה, על דרך ונשא בו אלה להאלותו:
(1) לא תשא, invoking the name of G’d when swearing an oath. The word נשא is used in this sense in Kings I 8,31 ונשא בו אלה לאלותו, “when someone utters a curse against another in retaliation, using the curse to make his adversary swear an oath,”

Explains that this commandment is using Hashem’s name when swearing an oath. Also explains where the word תשא comes from

(א) לא תשא וגו' - כל זה מכבודו של הקב"ה וגם שמירת שבת שאחריו. וגם כיבוד אב ואם שהוקש כבודם לכבוד של מקום, כדכתיב: כבד את ה' מהונך.
(1) לא תשא, both this commandment, as well as the two following deal with the honour due to G’d. We know that the commandment to honour parents is also almost on the same par as honouring G’d, as in Proverbs 3,9 the verse to honour G’d is introduced with the same word כבד as is the Torah’s instructions to honour one’s parents.

Rashbam explains that this commandment, and the next two commandments are about honoring Hashem

מאחר שלא ראית שום תמונה אין יכולת לישבע רק בשמו ואעפ״‎כ

Chizkuni:

Since you have never seen God, you are not allowed to swear by him.

Midrash: Hashem is saying not to misuse His Holy Name. It can be used in serious situations, such as when Avraham was in the fire, he used it to be saved. When Moshe was at Yam Suf, he used it. Etc. If you pronounce it in vain, you will surely be punished.

Midrash:

A way you can "misuse Hashem's name" is by acting righteous when in reality you are wicked.

Kli Yakar:

This commandment corresponds with the 8th one (Don't steal) because if you steal, it will lead you to swear falsely.

Halachos of Saying God's Name in Vain:

You shouldn't say a bracha in vain or recite one unnecisarily. If you do, or you say Hashem's name in vain, you should say "Baruch Shem Kavod..."

If you start a Bracha, and get as far as "Baruch Atah Hashem," and then realize that it is the wrong bracho, you should finish it with "Lamdeini Chukecha"

Ramban holds that it is always optional to swear with Hashem's name, and in court you don't have to.