Our verse calls the testimony “shav,” “in vain.” This testimony is worthless because each litigant has the right to hear and respond to his opponent’s case. If testimony is offered in the absence of one of the parties, it is unacceptable, as the present party may be inclined to overstate his case and the absentee is unable to correct him. To avoid this situation, judges are prohibited from hearing from either litigant until everyone has arrived.
Let’s say, for the sake of argument, that a judge is for some reason willing to hear one’s testimony in the absence of the opposing party. In such a case, it would still be prohibited for the present party to offer testimony as the Torah warns us to “keep far from any potentially-false situation” (verse 23:7). Additionally, the Talmud in Makkos (23a) uses our verse to support the idea that one may not accept words of lashon hara (gossip).
The reason for this mitzvah is that God hates falsehood. One litigant testifying in the other’s absence is too tempting a situation; it will invariably lead to some creative embellishments. As we’ve stated, God wants us to keep far away from such situations, so He commanded us not to put ourselves in this position.
This mitzvah applies in all times and places, specifically to the courts. In the Talmud, it is discussed in the tractates of Makkos (23a) and Shevuos (31a). In Shulchan Aruch, it is codified in Choshen Mishpat 17. Not hearing one litigant in the other’s absence is #281 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #65 of the 194 negative mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.