In the works of Creation, He set conditions for everything
Rabbi Aba says that when God created the world He foresaw events and created conditions for everything. When He created the fish he stipulated that a certain fish in the future would swallow Jonah. When He created the heavens He stipulated that they would raise Elijah by a storm of wind. When He created the firmament to divide water from water He stipulated that the waters would divide between defilement and purity so that Yisrael might purify in them. When He divided the land from the sea He stipulated that it would let Yisrael pass on dry land but drown the Egyptians. Also He stipulated that the dry land would open its mouth and swallow Korach and all his community. When He created the sun and moon He stipulated that the sun would stand still in the days of Joshua, and that the stars would fight Sisera. When He created the fish of the sea and the birds of the sky He stipulated that the ravens would feed Elijah and a fish would swallow Jonah and vomit him out again. When He created man He stipulated that a widow woman would descend from him and sustain Elijah. So He saw all these things on the six days of Creation.