Hi Amadeus,
The Jews that Jesus was speaking to at the time would have known of passages in Deuteronomy concerning the law. Deuteronomy 17 and 19 speak of 2 or 3 witnesses gathered to testify in court. The witnesses were necessary to establish a case in court.
The problem with the laws cited in Deuteronomy is in having two reliable and honest witnesses to establish the Spirit of the law. As we see with Naboth this is not always the case When Naboth stand behind his right to retain his own God-given inheritance he ran up against Ahab the king and Jezebel [I Kings 21]. When he refused to sell or trade his land, they brought two men willing to lie and in accord with the 'letter' [as opposed to the Spirit] of the law Naboth, an innocent man, was stoned to death. The difference between that and Matt 18:20 is the "in my name", which Jesus stated. If it had been two men who were "in the name of Jesus" it would have been a better result for Naboth. When two or three are "in His name" Jesus is there as well.
"Neither is there salvation in any other: for there is none other name under heaven given among men, whereby we must be saved." Acts 4:12
With that in mind the Matthew 18:20 passage you reference should be put in context. In context that passage is about dealing with Sin in the Church or disciplining an erring brother. Or in a nutshell it deals with Church discipline.
Bible study Mary
Tell that to Naboth! He leaned on the law given by God to Moses and died. We have something better than mosaic law. Listen to Jesus here:
"If I bear witness of myself, my witness is not true.
There is another that beareth witness of me; and I know that the witness which he witnesseth of me is true."
John 5:31-32
"What shall we then say to these things? If God be for us, who can be against us?" Rom 8:31