Deuteronomy 8:19

And it shall be, if thou do at all forget the LORD thy God, and walk after other gods, and serve them, and worship them, I testify against you this day that ye shall surely perish.

To forget the Lord is to fail to keep His commandments and judgments and statutes, and to walk after other gods and serve and worship them, against which God Himself testifies that His people shall surely perish and be destroyed as the nations destroyed before them perished for disobedience.
The danger comes in prosperity, when people are full and build good houses and see herds and flocks and silver and gold multiply, until the heart is lifted up in pride to claim that human power gained this wealth, forgetting that power to get wealth and every blessing come from God's mercy and not from human power or righteousness.
They were to remember God who brought them out of Egypt and the house of bondage, led them through the great and terrible wilderness, brought water from the rock and fed them with manna to humble and prove them, and gives power to get wealth to establish His covenant sworn to the fathers.
Obedience to God's law was the condition of continued prosperity, so that unthankfulness, selfishness and disloyalty cut His people off from His life and blessing and made it impossible for Him to fulfill His agreement with them.
That warning belongs to the present as verily as to Israel, written for the admonition of those upon whom the ends of the world are come, and leaders entrusted with sacred responsibilities must follow it in every detail lest God likewise vindicate His word against them for departing from His commandments.

Forgetting God in Prosperity

To forget the Lord is to fail to keep His commandments and judgments and statutes, and Satan worked repeatedly to bring that forgetfulness upon Israel in order to ruin the nation. That danger was to come with fullness and prosperity, when they should have eaten and been full, built goodly houses and dwelt in them, and seen herds and flocks and silver and gold and all possessions multiply. Then the heart would be lifted up in pride to say my power and the might of my hand has gotten this wealth, forgetting that wealth and blessing came not from human power or righteousness but from God's mercy. Prosperity itself would thus tempt them to pride and forgetfulness, as though strength and gain were their own, even while God had given them their wealth and blessings and called for continued obedience and loyalty.

Against that pride they were to remember God who brought them out of Egypt and the house of bondage. He had led them through the great and terrible wilderness with fiery serpents and scorpions and drought, brought them water out of flinty rock, and fed them with manna to humble and prove them to do them good at their latter end. He had protected and provided for them in that wilderness experience, testing and humbling them, and He it was who gives power to get wealth in order to establish His covenant sworn to the fathers. They were not to claim credit for what God supplied, but to remember and obey Him as the deliverer, sustainer, and giver of power to gain wealth.

If in that prosperity they should at all forget Him and walk after other gods and serve them and worship them, God Himself testified that day that they should surely perish and be destroyed. Their fate would be as the nations the Lord destroyed before them, who perished because they did not obey the voice of the Lord. Deliberate forgetting by turning to, serving, and worshiping other gods would make disobedience the cause of certain destruction, abandoning the One who had blessed and delivered them. That warning was verified when Israel disobeyed, so that all but two of the adults who left Egypt died in the wilderness instead of entering Canaan. Covenant unfaithfulness cut them off from God's life and blessing, for forgetting God and abandoning His commandments could develop gradually across generations into apostasy and its threatened destruction. The Jewish people ignored the warning, misused their privileges for self-glory, and failed to serve as God's representatives to the world, and apostasy thus became the cause of the chosen nation's ruin.

Warning for God's People Today

Continued prosperity depends on strict obedience, for obedience to God's law was the condition of its continuance, and disobedience brings serious consequences. Israel's unthankfulness, selfishness, and disloyalty made it impossible for God to fulfill His agreement with them. Keeping His commandments requires Christ to take away sin and give His own righteousness to those who believe and repent. The verse shows the sacredness of God's law, and turning from God to other gods brings the curse and leads to perishing.

The lesson of the whole eighth chapter is of the greatest importance and belongs to the present as verily as to Israel. Its warning applies to God's people as surely as it did to ancient Israel. It is a present word of the Lord written for the admonition of those upon whom the ends of the world are come. That warning bears on the final review, when every life is investigated and each case decided for eternity. It is connected with God rising up to do His strange work and with a consumption determined upon the whole earth.

The chapter's instructions are to be carefully followed in every detail by those entrusted with sacred responsibilities. If leaders of God's people today depart from His commandments, God will likewise vindicate His word against them. This calls for full submission to the will of the Lord instead of following human judgment up to a point and then holding to self. Such holding to self refuses to be molded after the similitude of Christ. Human standards are feeble reeds against the Lord's standard of perfection of character.