All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
First of all, it should be noted that taking the means is something Islamically required, and this is part of having full trust in Allaah. We have already discussed this in Fatwa 185287.
Likewise, getting ready and preparing power and other matters that a Muslim needs to support his religion and to defend his faith is something that he is enjoined to do at all times, and this has nothing to do with the appearance of the Mahdi or any other person; rather, the Muslims should not abandon taking the means of power out of relying on such matters. For more benefit, please refer to Fataawa 16286 and 5563.
The same thing applies to Muslims learning crafts and professions; look at what ‘Aa’ishah said about the Prophet, sallallaahu ‘alayhi wa sallam, when she was asked about what he used to do at home: ''He was a human among the humans, he used to search his garment (for harmful termites), milk his sheep, and serve himself.'' [Ahmad]
The Prophet, sallallaahu ‘alayhi wa sallam, when listing the types of charity, mentioned: ''… to help someone in his craft or to do the job for clumsy.” [Al-Bukhari and Muslim]
Besides, Rufaydah Al-Aslamiyyah used to treat the injured (in the battle) in her tent, as reported by Al-Bukhari in Al-Adab Al-Mufrad - Al-Albaani graded it Saheeh (sound).
Also, it is confirmed that Umm ‘Atiyyah, Umm Sulaym, Hamnah Bint Jahsh, Layla Al-Ghifaariyyah (the wife of Abu Tharr), Umm Ayman, and Ar-Rubayyi’ Bint Mu’awwith used to go out in the battle with the Prophet, sallallaahu ‘alayhi wa sallam, and treat the wounded and take care of the patients.
In regard to saving food for times of need without exaggeration and without indulging in illusion, then it is permissible and this is something which the Prophet, sallallaahu ‘alayhi wa sallam, did. ‘Umar, may Allah be pleased with him, narrated that the Prophet, sallallaahu ‘alayhi wa sallam, used to sell the dates of (the garden of the tribe of) Bani An-Nadheer and store for his family so much food as would cover their needs for a whole year. [Al-Bukhari and Muslim]
Allaah Knows best.