What is an oath? An oath is the calling on God to witness the truth of what we say.
For men swear by one greater than themselves, and an oath given as a guarantee is the final settlement of all their disagreement. (Hebrews 6:16)
What things are necessary to make an oath lawful? To make an oath lawful, three things are necessary: first, we must have a good reason for taking an oath; second, we must be convinced that what we say under oath is true; third, we must not swear, that is, take an oath, to do what is wrong.
And thou shalt swear: As the Lord liveth, in truth, and in judgment and in justice. (Jeremiah 4:2)
Further reading: CCC 2150-2151