God reminded Solomon that he would be blessed as long as he walked "in integrity of heart and uprightness, doing according to all that I have commanded you." But if Solomon or his sons turn away from following God and don't keep his commandments but serve and worship other gods, then the temple will be destroyed and Israel will be removed from the land.
Solomon was building great wealth. He had forced laborers (the Canaanites who were still living in the land they had conquered), started building a navy, and traded extensively with other nations. Besides other goods, he had an annual income of 2.5 TONS of gold! On top of that, officials from all over the world came to see him every year, bringing many gifts of gold, silver, garments, spices, horses, and mules. And Solomon traded with Egypt in order to purchase horses and chariots.
Deuteronomy 17:16-17 (emphasis added)
Moreover, he (the king of Israel) shall not multiply horses for himself, nor shall he cause the people to return to Egypt to multiply horses, since the Lord has said to you, "You shall never again return that way." Neither shall he multiply wives for himself, lest his heart turn away; nor shall he greatly increase silver and gold for himself.Solomon was not walking in integrity of heart and uprightness, doing all that God had commanded.
It is very easy to get distracted from our obedience to God and to get carried away with things of this world. It's something we have to be on guard for. It is very wise to set aside time regularly to seek God's face and search our hearts to make sure we are staying on track.
Lord, you know how the things of this world tempt us, for you were tempted also. Please help us to keep our focus on you and not get distracted by all the glittery things of this world. Amen.