Lottery is a sort of gambling, which Allah Almighty prohibits. Thus, it is not lawful for you, dear brother in Islam, to use this money to perform Hajj. Hajj is one of the greatest acts of obedience performed for the sake of Almighty Allah, and hence, it is to be paid for using the purest sources of one’s lawful wealth.
Responding to the question Dr. Husam al-Din Ibn Musa `Afana, professor of the Principles of Islamic Jurisprudence at the University of Jerusalem, states the following:
Lottery is a kind of gambling that Allah Almighty forbids. He Almighty says: “O ye who believe! Intoxicants and gambling, (dedication of) stones, and (divination by) arrows, are an abomination,- of Satan’s handwork: eschew such (abomination), that ye may prosper. Satan’s plan is (but) to excite enmity and hatred between you, with intoxicants and gambling, and hinder you from the remembrance of Allah, and from prayer: will ye not then abstain?” (Al-Ma’idah: 90-91)
The lottery money, which the questioner won is not a legal source of wealth; it is just like gambling. Both depend on luck or chance. It was reported that (the great scholars) Muhammad Ibn Sirin, Mujahid, and `Ata’ said that everything concerning gambling depends on luck.
The questioner should get rid of this money through giving all of it to the poor and the needy or spending all of it on the general interests of Muslims like contributing to building a school or a hospital and so on. It is not lawful for him to keep this money or make use of it in any area of personal interest, whether for himself or any member of his family.
Many scholars are of the opinion that getting rid of illicit money is to be done through giving all of it in charity. For example, Ibn Taymiyah was asked about whether the wealth of a usurer would be lawful for his inheritors who knew about his transactions. To this, he answered: ‘The inheritors are to take out from the wealth the sums they think were gained by usury and return them to the people who paid them. If they cannot reach those people, they are to give these sums in charity.’ (Majmu` Fatwa Ibn Taymiyah, vol. 29, p. 307)
Ibn Taymiyah was also asked about the case of a woman who was a singer but then she repented. Would it be lawful for her to spend from the money she gained from singing as a livelihood, or would she be rewarded if she gave this money in charity? He said that the money the woman had gained from singing would not be lawful for her and she had to give all of it in charity (Majmu` Fatwa Ibn Taymiyah, vol. 2
9, pp. 308-309)
Likewise, when he was asked about what should be done by the one whose wealth contained both lawful and illegal money, he answered: ‘The person in question has to estimate how much illegal money he has earned and give that sum of money to the people he has deceived in this regard. If he cannot do so, he is to give the sum in charity.'(Majmu` Fatwa Ibn Taymiyah, vol. 29, p. 308)
Explaining Allah’s words: “and if you repent, then you shall have your capital; neither shall you make (the debtor) suffer loss, nor shall you be made to suffer loss”, Imam Al-Qurtubi said: ‘Scholars are unanimous that the way to repent for the one who has gained illicit money out of usury is to return the amounts of interest he has gained to the people he has taken them from. If he cannot find those people, he is to give this money in charity. The same applies for those who gained illegal wealth by deceiving others.
If there is confusion about how much illegal money and how much legal money he has, he must think deeply and try to work out how much money to remove from his wealth so as to purify it from this illegal money. This should be done to remove all doubt about the lawfulness of the money remaining with him. Then he is to return the money to its rightful owners. If he is not able to find them, he must give the money in charity. Should the amount of illegal money he is sure he has gained, outweighs the wealth he has in the time being, in order to be on the safe side, he is to give all that he has to the poor and needy or spend it on the public interests of Muslims. (Tafsir Al-Qurtubi, vol. 3, p. 366)’
In this respect it was reported by Abu Dawud that Qulayb reported on the authority of his father that a man from the Ansar said: ‘We went out with the Prophet (peace and blessings be upon him) to escort a deceased person to his grave. I saw the Prophet (peace and blessings be upon him) standing beside the grave (while it was being dug), and advising the gravedigger to widen the grave in the place where the deceased’s head and legs would be put. When he (peace and blessings be upon him) returned home, a messenger from a woman came to him inviting him (and his companions) to a meal. He (peace and blessings be upon him) accepted the invitation. When the food was served, the Prophet (peace and blessings be upon him) stretched out his hand to eat, and so did his companions. The attendants watched the Prophet (peace and blessings be upon him) while he took a bite of the food, and then he (peace and blessings be upon him) said: ‘I feel this is meat from a she-goat that was taken without its owner’s permission.’ The woman was sent for. [When she came,] she said: ‘O Allah’s Messenger, I sent someone to Al-Baqi` to buy me a goat, but he did not find one. So, I sent for a neighbor of mine to sell me a goat he had bought, but he was not there. I sent for his wife to give me the goat (for something in return) and she did. Upon this, the Prophet (peace and blessings be upon him) said: ‘Give this food to the captives [as charity]. ‘
According to this hadith, the Prophet (peace and blessings be upon him) ordered that the meat of the goat that had been served to him should be given in charity. This occurred when he (peace and blessings be upon him) knew that it had been taken without its owner’s permission.
The great scholar, `Ali Al-Qari commented on this hadith saying: ‘It is evident from this hadith that buying this goat was not valid because the permission and consent of its owner were not available.’ (Mirqat Al-Mafateeh, vol. 10, p. 297)
According to some scholars, the ruling regarding getting rid of illegal money through giving it in charity is based on the ruling that when something is found and it is difficult to find its owner, it should be given in charity
It is to be kept in mind that getting rid of ill-gotten money by giving it in charity is regarded as an act of charity in as much as it is given to the poor and needy, not in terms of being an act that will be rewarded. In other words, the giver in this case gives money to the poor and needy as a means of expressing repentance to Almighty Allah for gaining this money in a dishonest way, not as a means of obtaining a reward from Him. The act of giving here is a condition for repentance being accepted, and so, it is not rewarded.
Based on the above, it is not lawful for the questioner to perform Hajj by using the lottery money he won. Hajj is one of the greatest acts of obedience to Allah, the Almighty, and so, it is to be paid for from the purest part of one’s wealth.
Allah, the Almighty says: “So make provision for yourselves (Hereafter); for the best provision is to ward off evil.” (Al-Baqarah: 197)
He, the Almighty also says: “Allah accepts only from those who ward off (evil).” (Al-Ma’idah: 27)
The Prophet (peace and blessings be upon him) said: “Allah, the Almighty accepts acts of charity, but He, the Most High does not accept therefrom but that which is gained honestly.” (Reported by At-Tirmidhi)
He (peace and blessings be upon him) also said: “If anyone gives in charity the equivalent of a date from money that is honestly earned, for Allah only accepts that which is lawful, the Lord would accept it with His Right Hand, and even if it is a date, it would grow in the Hand of the Lord, as one of you raises his colt, until it becomes bigger than a mountain.” (Agreed upon by Al-Bukhari and Muslim)