"If you walk in My statutes (be-ḥuqqotai), etc." (Leviticus 26:3). This is what Scripture says: "If his days are determined, [the number of his months is with You; You have set limits (ḥuqqav) that he shall not pass]" (Job 14:5). What is the meaning of "If his days are determined"? When the Holy One, blessed be He, created the world, He determined the days of each and every one, as it is said, "And let them be for signs and for seasons, [and for days and years]" (Genesis 1:14). And to whom did He give them? To Israel, as it is said, "He declares His words to Jacob, [His statutes (ḥuqqav) and His ordinances to Israel]" (Psalms 147:19). "The number of his months is with You; You have set his limits (ḥuqqav)" (Job, ibid.). The Holy One, blessed be He, said to Israel: If you carry out My statutes, the Adversary (ha-Satan) shall not touch you, as it is said, "As often as it passes through it shall take you" (Isaiah 28:19). "You have set his limits that he shall not pass" (Job, ibid.). So I said to Solomon at the hour when he asked for wisdom. And what did I say to him? "Also that which you did not ask I have given you, both riches and honor" (I Kings 3:13). And if you uphold the Torah, the angel of death shall not touch you, as it was said to him, "And I will lengthen your days" (ibid., ibid. 14). "You have set his limits that he shall not pass, etc." Adam, the first man—had he kept the Torah and the commandments that I gave him, he would not have died. Therefore it is written, "If you walk in My statutes, etc."
Why Adam Would Not Have Died If He Kept the Torah
Midrash Tanchuma Buber, Bechukotai 1:1
אם בחקתי תלכו וגו' (ויקרא כו ג). זש"ה אם חרוצים ימיו [ומספר חדשיו אתך חקיו עשית ולא יעבור] (איוב יד ה), מהו אם חרוצים ימיו, כשברא הקב"ה את העולם חרץ ימיו של כל אחד ואחד, שנאמר והיו לאותות ולמועדים [ולימים ושנים] (בראשית א יד), ולמי נתנם לישראל, שנאמר מגיד דבריו ליעקב [חקיו ומשפטיו לישראל] (תהלים קמז יט), מספר חדשיו אתך חקיו עשית (איוב שם), אמר הקב"ה לישראל, אם עשיתם (חוקיו) [חוקי], אין השטן נוגע בכם, שנאמר מדי עברו יקח אתכם (ישעיה כח יט), חקיו עשית ולא יעבור (איוב שם), כך אמרתי לשלמה בשעה ששאל את החכמה, ומה אמרתי לו, גם אשר לא שאלת נתתי לך גם עושר גם כבוד (מ"א ג יג), ואם תקיים את התורה, אין מלאך המות נוגע בך, שנאמר לו והארכתי [את] ימיך (שם שם יד), חוקיו עישת ולא יעבור וגו'. אדם הראשון אילו שמר את התורה ואת המצות נתתי לו לא מת, לפיכך כתיב אם בחקותי תלכו וגו'.