Praying for the well being of Imam Zaman (aj) is an Islamic command that has its own reasons, even if we never learn of those reasons. Some of the reasons though, can be the following:
1- Praying for his well-being factors into such and Allah (swt) knows that at all times, there will be some who pray for that, thus ensuring his well-being at all times. Of course, this doesn’t mean that if no one doesn’t pray for it anymore, he won't remain well anymore; it is similar to how Allah (swt) has ensured that religion will always remain even if some turn away from it.
2- Praying for his well-being encompasses even minor ailments and sickness. What is for sure, is the existence of the imam (aj), but his always being healthy and robust isn't for sure, so our prayers can be effective from this perspective and this in no way contradicts the will of Allah (swt).
Praying for the well-being of the imam of our time is one of the commands of our religion that has its own reasons, and although these reasons may remain undiscovered to us, they are reasons that have to do with the real world, the same way a practitioner prescribes a certain medicine for a certain reason. In any case though, we act upon these commands and are sure that there are reasons behind why we have been asked to pray for his well-being. Nevertheless, some of the reasons for this can be of the following:
1- These prayers actually contribute to the well-being of the imam (aj). This doesn’t mean that if we don’t pray for it, he won't remain healthy, because no matter what, there are always individuals who are praying so. In other words, the effect of the prayer of these individuals is ‘substitutive’, meaning that if one doesn’t pray, another’s prayer will have its effect and so on, the same way religion is preserved; if some turn away from it, it won't perish, because “فَقَدْ وَکَّلْنا بِها قَوْماً لَیْسُوا بِها بِکافِرین”[1] (So if they disbelieve in them, We have certainly entrusted them to a people who will never disbelieve in them). What matters is that we are proud to be the ones who pray for him. There may be a general rule in this world that there will always be ones who pray for him, who these people are, is up to us and whether we choose to be them or not.
2- Praying for his well-being covers even the smallest ailments and discomforts; what is for sure is that the imam (aj) will remain alive till his appearance, how that will happen and if it is possible for him to get sick or not, or any other hardship may depend on whether we pray for it or not, thus our prayers may actually play a role from this point of view and this in no way is in contradiction with the will of Allah (swt).