God had forbidden the Israelites to marry foreign women who worshiped idols. God knew the negative consequences of that kind of intermarriage. But, king Ahab just like Solomon got married to many foreign idolatrous women. He even built idol-temples, places where his wives and others worshiped the idols. These kind of actions greatly increased idol worship among the Israelites. Slowly and gradually they became an idolatrous nation and became guilty of these terrible sins.
The sin of any person not only has a personal impact but also bad effects on others.