The important thing, Jesus is saying (in Matthew 5:33-37), is to tell the truth and keep one's pledges without insisting that a certain form of words must be used if it is to be binding. No oath is necessary for the truthful person... Their word is so reliable that nothing more than a statement is needed from them.
D.A. Carson
Matthew, The Expositor's Bible Commentary, Zondervan, 1984, p. 124-125.
Some people think (our Lord's words in Matthew 5:33-37) prohibits them from taking oaths in a courtroom, or from taking an oath of allegiance. Their desire to obey God's Word is admirable; but I submit they have really not understood it. As usual, Jesus is preaching in antithetical fashion; and it is important to discover just what He is saying before we take His statement with such insensitive absoluteness.
D.A. Carson
The Sermon on the Mount, Baker, 1978, p. 47