For trading in shares to be considered permissible it must meet two conditions. Firstly, the line of business must not include anything haram, such as wine, pork and so on. Secondly, dealings must be absolutely free of riba (usury). If the trade fulfills these two conditions, it will be <>halal</> and one can use its profits to perform Hajj.
Dr. Ahmad Yusuf, professor of Islamic Shari`ah at the Faculty of Dar Al-`Ulum, Cairo Univ., states: A share means an equal part into which the ownership of a company is divided and which can be bought by members of the public. The profit of such shares is halal. The price of the share increases in relation to the increase of people’s request for the goods and services provided by the company.
Stock is a huge market with various economic activities, among which there is the buying and selling of shares. Trading in shares is no different from any other line of business. If the traded objects are permissible, then the dealings are also permissible. If, on the other hand, the line of trade is haram, then all the dealings are rendered haram.
The same applies to shares. Shares in companies that deal in halal businesses are halal, and so are the profits. Likewise, shares in companies dealing in haram goods and projects are haram, and so are their profits.
In conclusion, trade in general is halal, and share trading is no exception. Allah, the Almighty says what means: (And when the prayer is ended, then disperse in the land and seek of Allah’s bounty) (Al-Jumu`ah 62:10) Seeking Allah’s bounty in this verse refers to trade. Also, the Prophet (peace and blessings be upon him) was a trader before he was assigned his mission. Hence, a Muslim must pursue all that is halal in every aspect of life, especially acts that bring one closer to Allah, because Allah, the Almighty is Good and He accepts only that which is good. This means that a Muslim who wishes to perform Hajj must pursue this goal from an income that is undoubtedly halal.
So, dear questioner, if you trade in shares in companies which deal in halal goods and projects such as cars, textile, foods and pharmaceuticals, then your money is halal, as it is gained from halal sources. However, subscribing to companies that sometimes deal in halal projects and at other times involve themselves in haram goods and projects is doubtful, and so your money will also be doubtful and not purely halal, and if this is the case it cannot be used for Hajj.
The Prophet (peace and blessings be upon him) said: “That which is halal is plain and that which is haram is plain and between the two of them are doubtful matters about which not many people know. Thus, he who avoids doubtful matters clears himself in regard to his religion and his honor, but he who falls into doubtful matters falls into that which is unlawful.”
If you fall within the second category of people, who fall into doubtful matters, then you should seek halal sustenance by subscribing to companies, which deal in purely halal goods and projects. Once your lawfully-gotten money exceeds the amount required to cover all your financial obligations and fulfill the needs of your family and those under your guardianship, you can use it for Hajj. Hajj is only obligatory on those who have the physical and financial ability, and this is by the consensus of Muslim scholars. Moreover, it is not an obligation that must be performed immediately; it can be offered whenever the person is able to do so, and this is the opinion according to the most reliable legal advisors.