Rabbi Shimon ben Lakish said: What is the meaning of what is written, "And there was evening and there was morning, the sixth day" (Genesis 1:31)? This teaches that the Holy One, blessed be He, made a condition with the works of creation: "If Israel keep the Torah, you shall endure; and if not, I will return you to formlessness and void." This is what is written, "From heaven You proclaimed judgment; the earth feared and was still" (Psalms 76:9). If it "feared," why was it "still"? And if it was "still," why did it "fear"? Rather, at first it "feared," and in the end it was "still."
Creation Held on Condition That Israel Keep the Torah
Yalkut Shimoni on Torah 16:12
אָמַר רַבִּי שִׁמְעוֹן בֶּן לָקִישׁ, מַאי דִּכְתִיב וַיְּהִי עֶרֶב וַיְּהִי בֹּקֶר יוֹם הַשִּׁשִּׁי מְלַמֵּד שֶׁהִתְנָה הַקָּדוֹשׁ בָּרוּךְ הוּא עִם מַעֲשֵׂה בְּרֵאשִׁית אִם יִשְׂרָאֵל מְקַיְּמִין אֶת הַתּוֹרָה אַתֶּם מִתְקַיְּמִים, וְאִם לָאו אַחֲזִיר אֶתְכֶם לְתֹהוּ וָבֹהוּ. הַיְנוּ דִּכְתִיב "מִשָּׁמַיִם הִשְׁמַעְתָּ דִין אֶרֶץ יָרְאָה וְשָׁקָטָה", אִם "יָרְאָה" לָמָּה "שָׁקָטָה", וְאִם "שָׁקָטָה" לָמָּה "יָרְאָה", אֶלָּא מִתְּחִלָּה "יָרְאָה" וּלְבַסּוֹף "שָׁקָטָה".