2 Chronicles 7:17

And as for thee, if thou wilt walk before me, as David thy father walked, and do according to all that I have commanded thee, and shalt observe my statutes and my judgments;

This promise belongs to God's answer to Solomon after seven days spent in dedicating the temple, when the ceremonies were ended and fire came down from heaven and the glory of the Lord filled the house so that the priests could not enter. Before stating the condition, God assured Solomon that He had heard his prayer and supplication and had hallowed the house Solomon built to put His name there forever, with His eyes and heart there perpetually.

Solomon's duty was set before him plainly: he was to walk before God as David his father walked, in integrity of heart and uprightness, doing according to all that God had commanded and observing His statutes and judgments. That upright walk and full obedience to all His commands was the basis on which Solomon's rule depended. The promise to establish the throne of his kingdom over Israel forever was conditional on that faithful obedience, in fulfillment of the covenant made with David his father that there should not fail him a man upon the throne of Israel, that he should never lack a man upon the throne. His continued kingship and Israel's security depended on this faithful obedience, and God promised to be with Solomon as He had been with David.

Had Israel remained faithful and true to God, this glorious building would have stood forever as a lasting and perpetual sign of God's especial favor to His chosen people. Israel was distinguished as peculiar because alone among all the nations of earth they preserved the true worship of God by keeping His commandments. Solomon's faithful reign would have influenced surrounding nations for good and been a means of exalting Israel among them as a wise and understanding people.

If Solomon and his children turned from following God and would not keep His commandments and statutes, but went to serve other gods and worship them, God would cut off Israel out of the land given them and cast the hallowed house out of His sight, and Israel should become a proverb and byword among all people. Prosperity and worldly honor brought temptations to apostasy, against which Solomon was warned. God's people may expect prosperity when they follow His way, but they cannot claim His blessing while refusing to trust and obey Him.