Sometime, you might write out a list of what you consider to be the top 10 verses in the Bible. In that kind of a list, many of us would surely include 2nd Chronicles 7:14. It is a verse with just about as much "stand alone" power as John 3:16. In fact, it stands by itself so well that I usually don't even consider or remember its original context. But, today it's impossible not to look at that context.
The temple was complete, God's presence was evident, Solomon had prayed a prayer of invocation and fire from heaven had fallen upon the main offering. It was in that context that God spoke those great and famous words to Solomon: “If My people…” The offer wasn't made during a time of rebellion, judgment and poverty. It was, however, made in anticipation of and preparation for that eventual situation. God knew that they would forsake Him and that as a result hard times would come upon them. So, He gave them the formula for restoration and revival, even before they needed it.
Now, actually, God wasn't prescribing a cure as much as He was agreeing with what Solomon had already postulated (in chapter 6). If you read Solomon's invocative prayer you'll see that he already understood what was required for God's mercy to be released upon His people.