Imam al-Shafi'i (may Allah have mercy on him) said: "Allah, the Blessed and Exalted, says: 'And you were not with them when they cast their pens (to draw lots) as to which of them would take charge of Maryam, nor were you with them when they disputed.' [Surah Al Imran: 44]
And He said: 'And indeed Yunus (too) was among the messengers, when he fled to the laden ship; then he drew lots and was among the losers.' [Surah al-Saffat: 139-141]
So the basis for drawing lots is found together in the Book of Allah, the Mighty and Majestic, in the accounts of those who drew lots over Maryam (peace be upon her) and of those who drew lots with Yunus (peace be upon him). And drawing lots, and Allah knows best, takes place only between people who are equal in their claim."
And he spoke on this in detail, and it is transmitted in Kitab al-Mabsut.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / Q21402
Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrates its explanation from the Companions: Concerning the story of Maryam: those people who used to write the Torah, when a person was brought to them, would test him by drawing lots over him to decide who would teach him. Sayyiduna Zakariyya (peace be upon him) was the most virtuous of them and was also a prophet, and the sister of Maryam was married to him. When they brought her, Sayyiduna Zakariyya (peace be upon him) said: "I am more entitled than you, because her sister is married to me." But they still refused, so they went to the River Jordan and cast into the river the pens with which they used to write the Torah, (to decide) who would take charge of her. The pens were carried along by the current, but the pen of Sayyiduna Zakariyya (peace be upon him) stood upright on its tip as though it were in mud, so Sayyiduna Zakariyya (peace be upon him) took the girl.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21402
Mujahid (may Allah have mercy on him) says regarding 'And Zakariyya took charge of her' [Surah Al Imran: 37]: Sayyiduna Zakariyya (peace be upon him) took charge of her. He drew lots by means of his pens and then took charge of her. 'Then he drew lots and was among the losers' [Surah al-Saffat: 141]: he was among those who lost.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21403
Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) said regarding the words of Allah Almighty 'Then he drew lots' [Surah al-Saffat: 141]: that is, he cast lots with them; 'and was among the losers' [Surah al-Saffat: 141]: he was among those who lost.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21404
Qatadah (may Allah have mercy on him) says regarding 'Then he drew lots and was among the losers' [Surah al-Saffat: 141]: he drew lots and lost. The Prophet of Allah Yunus (peace be upon him) drew lots and lost in the lot. The narrator says: The ship was held back, and the people realised that it had been held back because of a wrong that one of them had committed. So they drew lots, and the lot fell on Yunus (peace be upon him), and he threw himself into the sea. 'Then the fish swallowed him while he was blameworthy' [Surah al-Saffat: 142]: the fish swallowed him while he was blaming himself; he was regretful for what he had done. 'And had he not been of those who glorify (Allah)' [Surah al-Saffat: 143]: that is, he used to pray a great deal in times of ease, so He saved him.
Imam al-Shafi'i (may Allah have mercy on him) said: The drawing of lots by the Prophet (peace and blessings be upon him), in every instance in which he drew lots, has exactly the same meaning as that of those who drew lots for the guardianship of Maryam (peace be upon her), without differing from it.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21405
Sayyiduna Imran bin Husayn (may Allah be pleased with him) says that a man of the Ansar died and left six slaves, and he had no other wealth; he had freed all of them at the time of his death. The matter reached the Prophet (peace and blessings be upon him), and he (peace and blessings be upon him) divided them into three groups, and by drawing lots he freed two and kept the remaining thirds, that is, four, in slavery.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21406
Sayyiduna Imran bin Husayn (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said, when this matter came before him: "Had I known, I would not have offered his funeral prayer." In the narration of Jarir bin Hazim it is that he (peace and blessings be upon him) freed one third and kept the remaining two thirds in slavery; in another narration it is that he (peace and blessings be upon him) freed two and kept four in slavery, and this is what better fits the drawing of lots.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21407
Alqamah bin Waqqas and Ubaydullah bin Abdullah bin Utbah narrate from Sayyidah Aishah (may Allah be pleased with her), the wife of the Prophet (peace and blessings be upon him), that whenever the Messenger of Allah (peace and blessings be upon him) intended to travel somewhere, he would draw lots between his wives, and whichever of them had her lot come out would go with the Prophet (peace and blessings be upon him). She says: In one campaign my lot came out, and I went out with him (peace and blessings be upon him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21408
Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "If people knew how much reward there is in the call to prayer (adhan) and the first row, they would draw lots for it. If they knew the reward of coming early at midday, they would race one another to it. If they knew the reward of the Isha and Fajr prayers, they would come to them even if crawling on their knees."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21409
Sayyiduna Nu'man bin Bashir (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "The one who stands firm within the limits of Allah and the one who transgresses them are like two groups who drew lots for a ship: one group got the upper part and the other the lower part. When those below needed water, they would go to those above, who were troubled by it. Those below said: 'If only we made a hole in our part and got water from it, so that those above are not troubled.' If they leave them, that is, let them do it, they will all perish; and if they hold them back by the hand, they will all be saved."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21410
Kharijah bin Zayd bin Thabit (may Allah have mercy on him) says that Sayyidah Umm al-Ala al-Ansariyyah (may Allah be pleased with her) used to say: When the Muhajirun came to Madinah, the Ansar drew lots for their housing, and Sayyiduna Uthman bin Maz'un (may Allah be pleased with him) fell to our lot for housing.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21411
Kharijah bin Zayd bin Thabit (may Allah be pleased with him) says that Umm al-Ala (may Allah be pleased with her) had given the pledge of allegiance to the Prophet (peace and blessings be upon him). She says: When the Ansar drew lots for the housing of the Muhajirun, the housing of Sayyiduna Uthman bin Maz'un (may Allah be pleased with him) fell to our share. He fell ill and died, and we shrouded him in his clothes. Then the Messenger of Allah (peace and blessings be upon him) came to us, and I said: "May the mercy of Allah be upon you, O Abu al-Sa'ib! I bear witness that Allah has honoured you." The Prophet (peace and blessings be upon him) said: "How do you know?" She says: By Allah, O Messenger of Allah (peace and blessings be upon him), I do not know. He (peace and blessings be upon him) said: "As for him, the certainty (death) has come to him, and I hope for good for him from Allah. By Allah, though I am the Messenger of Allah, I do not know what will be done with me or with you." I said: By Allah, I will never again declare anyone pure. She says: I saw for Sayyiduna Uthman bin Maz'un (may Allah be pleased with him) in a dream a flowing spring. I mentioned it to the Messenger of Allah (peace and blessings be upon him), and he (peace and blessings be upon him) said: "That is his deeds, which continue to flow for him."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21412