Deuteronomy 11:8-9:

Therefore shall ye keep all the commandments which I command you this day, that ye may be strong, and go in and possess the land, whither ye go to possess it;
And that ye may prolong your days in the land, which the LORD sware unto your fathers to give unto them and to their seed, a land that floweth with milk and honey.

Notes on Deuteronomy 11:8-9:

We see yet another case here where obeying God is linked to long life.

See also:

Some of God’s Promises Have Conditions
Is There an Appointed Time for Each Person to Die?