“Again you have heard that it was said to those of old, ‘You shall not swear falsely, but shall perform to the Lord what you have sworn.’ But I say to you, Do not take an oath at all, either by heaven, for it is the throne of God, or by the earth, for it is his footstool, or by Jerusalem, for it is the city of the great King. And do not take an oath by your head, for you cannot make one hair white or black. Let what you say be simply ‘Yes’ or ‘No’; anything more than this comes from evil.” Matthew 5:33-37
This would shake up the legal system a bit. It is ironic that swearing an oath on the Bible is explicitly forbidden in the Bible.
The danger of oaths is found in the Gospels: Herod’s oath, which because he could not back out of it led to the death of John the Baptist. Oaths are strong things.
What Jesus is getting at is integrity. We should be seen as being truthful and trustworthy so that an oath is not required, we will be trusted anyway.
As for making an oath in court: What you are doing there is testifying to what you have seen heard or what you know of someone’s character. As it does not involve a promise to do something I can’t see the problem.