You never know when you might need him.
The following is my favorite midrash for this week's Torah portion. It should soon become obvious why that is:
מדרש רבה בשלח פרשה כא
דבר אחר מה תצעק אלי הדא הוא דכתיב (איוב לו, יט) היערוך שועך לא בצר מהו כן אמר רבי אלעזר בן פדת המשל אומר כבד את רופאך עד שלא תצטרך לו ורבי שמעון בן לקיש אומר ערך שוע כלפי בוראך כדי שלא יהיו לך צרים מלמעלן
Midrash Rabbah, portion Beshalach, 21
Another matter regarding "Why do you cry out to Me? [Exodus 14:15]": It is written (Job 36:19): "Will Your riches avail, that are without stint (or all the forces of Your strength?)" What does this mean? According to R. Elazar ben Pdas: The parable says, "Honor your healer until you need him." Similarly, R. Shimon ben Lakish says, "Prepare a cry before your Creator so that you won't have enemies Above."
In this week's portion, Moses cries out to God -- a thing which puzzles the commentators, since God had already told Moses explicitly that Egypt would fail and the Israelites would be saved. In any case, one simple meaning of God's question, "Why do you cry out to Me?", is that Moses should not be crying out to God: it is the time for action. "Speak to the Israelites and [tell them that] they should go." Quit praying!
The midrash connects the verse in Exodus to an even more obscure verse in the Book of Job. Some take the word שוע in this verse to mean "riches," and render the word צר as "narrowness." Hence the translation above: "Will Your riches avail, that are without stint?"
The Rabbis quoted in this midrash, however, take שוע to mean "cry, petition" (in the sense of prayer), and צר to mean "foe." They might translate the verse this way: "Will you put your prayer in order before the foe has even appeared?" To this way of thinking, God's question to Moses is not "Why are you praying when there's action to be taken," but "Why are you praying before there's even anything to be worried about," i.e. before the Egyptians are even threatening to overtake the Israelites?
In other words, the general thrust of this midrash is that one should pray to God before one's enemies appear -- before one is in trouble. (The parallel versions of this midrash, in the Jerusalem Talmud and in the Midrash Tanchuma, support this understanding. In the Yerushalmi, the verse from Job is brought as an explanation for the parable, which there appears in Aramaic.) But the support brought in the midrash for this way of thinking -- the proverb brought by R. Elazar ben Pdas -- is what makes it fascinating.
"Honor your healer until you need him": what does this mean? First off, we should say that the Hebrew word רופא (royfe), though familiar in Modern Hebrew as the equivalent to English "doctor," means something else again in Rabbinic texts. (A lengthy review of the etymology and various meanings of the word is here.) A רופא is what could be called in other contexts a "soul healer," an expert who has the power to keep others healthy through Divine intercession.
To see this, compare Exodus 15:26, where God says (JPS translation): "'If thou wilt diligently hearken to the voice of the LORD thy God, and wilt do that which is right in His eyes, and wilt give ear to His commandments, and keep all His statutes, I will put none of the diseases upon thee, which I have put upon the Egyptians; for I am the LORD that healeth thee.'" That is, אני ד´ רופאך, I, God, am your רופא, your healer. But what sort of a healer cures diseases that have not been "put upon thee"? One which keeps the diseases from emerging in the first place. God the public-health worker? That would be an anachronism, unfortunately. God the faith healer makes more sense.
One more thing we need to understand: what does it mean to say "Honor your healer until you need him"? Jastrow lists a second meaning of the verb כבד, "to offer a gift." The healer is to be supported (financially!) by his community until such time as he's needed. Thus the prayer the Rabbis suggest in this midrash is in the nature of an investment. Prayer is "laid up" by the petitioner against a rainy day, or, rather, against the day when enemies come. (Maybe this provides the link between the verse in Job and the cited parable: the root ערך can also have the meaning "valuation.")
In other words, make sure to support your local healer. You never know when they might come in handy.