From the beginning of time the oath was the most sacred, solemn attestation a person could make to affirm a statement or his word on a matter. Before much time had passed, however, the oath was misused or used for nefarious purposes, as when Cain and his followers swore an oath to Satan in order to gain power (see Moses 5).
Further, men and women over the generations began to abuse the oath through swearing by things over which they had no control: the earth, the moon, the stars, or the heavens. Jesus’ was a call to a higher righteousness, an invitation to let our word be our bond. When we say yea, then let the truth of the matter be yea; when we say nay then let nay be the word.
Essentially Jesus called for the cessation of oaths and counseled his followers to be people of their word, honest and trustworthy in every regard. Though we in modern times are prone to refer to the use of profanity or vulgarity as swearing, and though such things are and should be reprehensible and inappropriate for one who seeks to follow Jesus, in reality these verses have nothing to do with condemning this latter vice.