Assallaamu alaykum wa rahmatullaahi wa barakaatuhu, Shaykh. Is it Bid'ah (innovation), wrong, or disliked to give charity if one sees a dream that could be referring to a disaster that lies ahead? If not, then with what intention should one give? May Allaah reward you, Shaykh.
All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
A dream may be true or untrue, and its literal meaning could be contrary to its interpretation, but charity (Sadaqah) is something that is encouraged every day.
Abu Hurayrah, may Allah be pleased with him, narrated that the Prophet said, “There is no day in which the slaves rise in the morning except that two angels descend; one of them says, 'O Allah! Compensate the one who spends.' The other angel says, 'O Allah! Destroy the wealth of the one who is stingy.'” [Al-Bukhari and Muslim]
It is also confirmed that charity repels calamities, as stated in the hadeeth, “Doing good (to the people) protects one from misfortunes, secret charity extinguishes the anger of the Lord, and keeping ties with kinship increases one’s life span.” [At-Tabaraani - Al-Albaani classified it as hasan (good)]
Also, Anas, may Allah be pleased with him, narrated that the Prophet said, “Doing good (to the people) protects one from misfortunes, calamities, and destruction; and the people of goodness in this worldly life will be the people of goodness in the Hereafter.” [Al-Albaani classified it as saheeh (sound)]
Moreover, the hadeeth reported by Al-Bukhari and Muslim about the solar eclipse reads, “The Prophet said, 'When you see that [i.e. the eclipse], supplicate Allah, say Allahu Akbar, pray, and give charity.'”
Ibn Daqeeq Al-‘Eed , when interpreting this hadeeth, said, “This hadeeth is evidence that charity is desirable when someone fears something in order to repel the misfortune that he fears.”
Imaam Ibn Al-Qayyim said in ‘Iddat As-Saabireen, “In charity, there are numerous benefits which no one can enumerate but Allah, among which is that it protects one from misfortunes and repels trials to the extent that it repels tribulations off an oppressor (i.e. charity repels tribulations even if it was given by an evil or an oppressive person). Ibraaheem An-Nakha'i said: 'They (the righteous predecessors) held that charity protects the oppressed man, wipes out the sin, preserves wealth, brings forth sustenance, brings joy to the heart, and necessitates having trust in Allah and thinking well of Him in the same manner that stinginess is mistrust in Allah. Charity repels the devil, purifies one’s soul and develops it, endears the slave to Allah and to His creation, and conceals all his defects in the same manner that stinginess conceals every good trait. Charity increases one’s life-span, incites people to supplicate for the person and to love him, repels the torment of the grave from the person, provides shade for him on the Day of Judgment, intercedes for him with Allah, eases the difficulties of this world and the Hereafter for him, and makes it easier for him to do all good deeds; indeed, its benefits are many times more.'”
Therefore, there is no harm in giving charity in order to attain what is confirmed in the Sharia as a promise to repel a calamity from the person who gives charity.
Allah knows best.