These verses are directly related to verse 15, "But it shall come to pass, if you do not obey the voice of the LORD your God, to observe carefully all His commandments and His statutes which I command you today, that all these curses will come upon you, and overtake you." Then all the curses are listed. Verse 45 continues the thought that ends with "and overtake you" in verse 15, but they are also directly related to much of the context of Deuteronomy 8.
God's concern in this context is for the attitude of heart and mind in which the Israelites carried out their part in keeping the covenant. It is actually a prophecy of what they were going to do. What can we learn from this? The very fact that this warning—"because you did not serve the LORD your God with joy and gladness of heart"—is in here means that these things are going to come on us. He is telling us that obeying in an obligatory fashion, while it is a great deal better than sinning, does not come close to what God is seeking for in us. That kind of obedience does not produce an internalized character that permits one to live an abundant life full of every good quality. Instead, it will produce joyless, hopeless, robotic automatons.
The word "gladness" is particularly interesting, literally meaning "good," or "goodness." However, when it is taken with the intent of this and other biblical contexts, especially Deuteronomy 8, it indicates "gratitude." In fact, The Amplified Bible inserts the word "gratitude" in brackets next to the word "gladness" as an explanation of what God is driving at.
In other words, God is saying that, if we do not approach life with an understanding recognition of the awesome significance of His calling, we cannot serve Him satisfactorily. There are reasons for this. He wants people who understand what life is about, not to approach life with a resigned, "Oh, well, I have to do this" attitude, but rather to approach it with a rejoicing, wholehearted understanding, gladly and gratefully yielding themselves to its completion in our lives.
John W. Ritenbaugh
New Covenant Priesthood (Part 3)