Would Biblical doctrine prohibit a Christian from taking an judicial oath (to tell the truth as a witness) or an oath of service for political office or military duty?
The Context of Matthew 5:34 must be understood in light of the question of verse 33 as well as the rest of the Bible. The problem being addressed by Jesus here is the swearing of oaths that were false - i.e. someone swears that he will do something that he does not intend to do (i.e. perjury), or something that he does not want to be binding. The statement of verse 33 “You shall not swear falsely, but shall perform your oaths to the Lord” is a statement made in Leviticus 19:12 & Deut 23:23 and was most certainly true. However, what the people had done was to avoid taking oaths in God's name (since they MUST then keep them), and had practiced oaths by other things (e.g. heaven, earth, etc.), which they did NOT consider binding since they were NOT "to the Lord". Jesus stated that the people should not swear by these things since they all belonged to God and the people had no control of them, and therefore to disrespect these things in false oaths was ultimately to disrespect God himself and thus is "from the evil one" -- i.e. a rebellion that is like that of Satan.
The concept of an oath before God (such as a judicial oath to swear before God to tell the truth and nothing but the truth) is not under consideration here at all. However, this type of oath is spoken of in the O.T. many times. Lev 19:12 did not forbid oaths in the name of God, but it did forbid false oaths in the name of God. On important occassions, many of God's people practiced oaths including Abraham (Gen 21:23,24), David (1 Sam 30:15), and Nehemiah (Neh. 13:25). Isaiah spoke of a time when God's people would be purified and at that time, anyone who would swear, would "swear by the God of truth" (Is 65:16). Even God himself is pictured in Heb. 6:13 as taking an oath:
The solemn oath of a faithful person is never spoken against in the scriptures, but the false oath and the rash oath are everywhere spoken against.
The christian should not have any problem with taking an oath before God with regard to faithful service, telling the truth, etc. However, He must recognize that this is not merely something that he promises to man, but represents a commitment before God.