The Prophet ﷺ said, "When two people both refuse the oath or both wish to take it, they should draw lots over it."Salama said, Muamar reported to us, and he said, "When two people are both compelled to take the oath."
حدثنا أحمد بن حنبل وسلمة بن شبيب قالا حدثنا عبد الرزاق قال أحمد قال حدثنا معمر عن همام بن منبه
عن النبي ﷺ قال إذا كره الاثنان اليمين أو استحباها فليستهما عليها قال سلمة قال أخبرنا معمر وقال إذا أكره الاثنان على اليمين
Its isnad is sahih. Baghawi narrated it in Sharh al-Sunnah, no. 255, through the hadith of Abu Dawud with this wording, and he graded it sahih. It is also in Musnad Ahmad, 2/317, and in the Sahifah of Hammam, no. 97. Its basis appears in Bukhari, no. 2674, with wording other than this, through the hadith of Abdul-Razzaq.