But if it is found that those two were guilty of sin [i.e., perjury], let two others stand in their place [who are] foremost [in claim] from those who have a lawful right. And let them swear by Allāh, "Our testimony is truer than their testimony, and we have not transgressed. Indeed, we would then be of the wrongdoers."
(O you who believe! When death approaches any of you, and you make a bequest, then take the testimony of two...) meaning that there should be two witnesses in such cases,
ذَوَا عَدْلٍ
(just men...) thus, describing them as just,
مِّنكُمْ
(of your own folk) Muslims.
أَوْ ءَاخَرَانِ مِنْ غَيْرِكُمْ
(or two others from outside) non-Muslims, meaning the People of the Book, according to Ibn `Abbas as Ibn Abi Hatim recorded. Allah said next,
Prior to this, there were injunctions relevant to religious considerations. Now some injunctions relevant to worldly considerations have been mentioned. The hint given is that the way Allah Ta` ala, in His mercy, helps His servants with better life in the Hereafter, He also takes care of better sustenance for them in the present world. (Bayan al-Qur'an)
The Background of Revelation
The event in the background of the revelation of the cited verses is that Budayl, a Muslim accompanied by Tamim and ` Adiyy, who were Christians at that time, travelled to Syria on a business visit. After reaching Syria, Budayl became sick. He made out a list of his things in writing and put it in his baggage. He did not inform his companions of the trip about it. When his sickness became serious, he called his Christian trip companions and made a will before them that they should deliver everything to his heirs. When they returned, they delivered everything to them. But, they took out a silver bowl which was polished with gold, or had gold inlay work on it, from the belongings. When the heirs found the list of things in the baggage left for them by the deceased, they asked the caretakers of the will if the deceased had sold something from the property, or was he very sick which may have compelled him to make unusual expenses. They answered their inquiry in the negative. Finally, the case came up for hearing before the Holy Prophet ﷺ . Since the heirs had no witnesses, the two Christians were put under oath. They declared that they had neither committed any breach of trust in what belonged to the deceased, nor had they hidden any of his things. In the end, based on the oath, the verdict was given in their favour. After the passage of some time, it was found that the two of them had sold that bowl to a goldsmith in Makkah. When asked, they said that they had bought it from the de-ceased. Since they had no witnesses at the time of purchase, they pleaded, they did not mention it earlier lest they be falsified.
If a man is on a journey and he senses that the time of his death is approaching, he should seek out two Muslims and hand over his personal possessions to them with proper instructions about bequeathing them to his inheritors. If he cannot find two Muslims in time, he should do likewise with two non-Muslims. These two persons should bring his possessions and hand them over to his heirs. At that time, if the inheritors have any doubts about the statement of the witnesses, they (the latter) should be detained in a mosque and should be made to take an oath before the general body of Muslims, which will testify that whatever they have said on behalf of the deceased was correct. If the inheritors are not satisfied with the statement on oath of the witnesses, then two of the inheritors should take an oath to that effect. Thereafter, a decision should be taken in accordance with their declaration. The giving of this right to the inheritors amounts to the establishment of a check, due to which no one will dare to commit a breach of trust.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.