Jesus’ statement is usually taken to mean that from Christ onward, a believer is not allowed to swear. Instead, he or she must simply be truthful. But like everything else, this statement had its own context.
“But I say to you, make no oath at all, either by heaven, for it is the throne of God, or by the earth, for it is the footstool of His feet, or by Jerusalem, for it is the city of the great King … let your statement be, ‘Yes, yes’ or ‘No, no’; anything beyond these is of evil.” (Mat. 5:34-37)
Swearing was mostly done not by the Name of God, therefore, it was considered less binding, working very much against the whole idea of guaranteeing the promise made.
However, in Numbers 30:2 we read: “When a man makes a vow to the Lord … he must not break his word; he must do whatever he has promised.” This is the basic meaning of not taking God’s Name in vain (Ex.20:7). Instead of presenting something new, Jesus recalls that which the Torah already specified.
This becomes even clearer when we read that: “… everyone who swears by God will exult, because the mouths of liars will be silenced.” (Ps.63:11) Even the apostle Paul, when he was accused by his enemies of doing great evil in the sight of God, called the Lord to be his witness that he was telling the truth (Gal. 1:20).
The upshot is that swearing must be limited only to extra-ordinary situations, and if one is going to swear, he or she must swear by the Lord God Himself. Nothing else will do.