Depositing one’s money in a riba-based bank helps the bank to deal in riba; this applies even if you do not get any interest on your deposit.
If you do get interest, this is the riba that is forbidden by Allaah and His Messenger. The Messenger of Allaah (peace and blessings of Allaah be upon him) cursed the one who consumes riba and the one who gives it.
Whoever has wealth that he wants to save or invest should look for a permissible way of doing so. He may give the money to a trustworthy man to do business with it for him, and they can share the profit in whatever manner they agree upon.
If he cannot find any way to save it other than depositing it in the bank, then there is no sin in that if it is done out of necessity, so long as that does not involve any interest.
He should choose the least evil of the banks, and the one that is closest to the way of dealing that is prescribed in sharee’ah.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) said:
With regard to depositing money in bank accounts that pay interest monthly or annually, this is a kind of riba that is forbidden according to scholarly consensus. With regard to depositing it without interest, it is better not to do that except in cases of necessity if the bank deals with interest, because depositing money with the bank, even if no interest is paid, helps the bank to engage in its riba-based transactions, so there is the fear that the one who does this may come under the heading of those who help others in sin and transgression, even if he does not intend to do so. We must beware of that which Allaah has forbidden and look for sound ways of preserving and disposing of wealth. May Allaah help the Muslims to do that which will lead to their happiness and victory and salvation. May He help them to quickly establish Islamic banks that are free of riba, for He is Able to do that. May Allaah send blessings and peace upon our Prophet Muhammad and his family and companions.
Fataawa Ibn Baaz, 4/30, 311
See also question no. 22392
And Allaah knows best.