Praise be to Allah.
It is not permissible to buy shares in companies that deal in haraam things, such as riba etc, whether the haraam is small or great, because a share is part of the company’s wealth, and its dealing in haraam means that everyone who invests in it is a partner in that haraam.
It is not permissible to trade in mixed and haraam shares, by buying, selling or investing, whether that is short term or long term, because it is not permissible to sell haraam things, whether in small or large amounts. A contract that involves that is a contract which it is not permitted to enter into.
Dr. Muhammad ibn Su’ood al-‘Usaymi (may Allaah preserve him) said: Some people differentiate between mudaarabah (buying and selling) and long-term investment and say that the one who engages in mudaarabah does not have to worry if he buys a share in a company that gives or takes riba-based loans. My response is to ask these people: What shar’i justification do you have for the profit that you make on the shares when they go up? He will never have any answer but to say: I am a partner in that company.
Similarly I say to him: what if the company were to make a loss a few minutes after you bought shares? Can you deny your connection to the company so that you will not have to bear any loss? Of course he will not be able to do that, and he will bear the same losses as all other regular shareholders. Not only that, if the company were to merge with another company or it were to be sold to another company, or it went bankrupt or was no longer on the stock market or its licence was taken away, all of that would have an effect on the mudaarib (one who buys and sells within a short period of time) and investor alike. So there is no difference between the mudaarib and the investor. End quote.
He was also asked about the ruling on mudaarabah (buying and selling) in mixed shares?
It is not permissible according to the majority of scholars, except in the case of “pure” shares, whether it is mudaarabah or investment. End quote.
And Allaah knows best.