The journeys of the Patriarchs through foreign territories placed them in constant vulnerability. Yet, bound by His covenant with them, God cast a shield of protection over them as they wandered through lands such as Egypt and the territory of the Philistines [אבן עזרא, ביאור שטיינזלץ]. This divine defense operated on two distinct levels, guarding the family against both the ordinary masses and powerful rulers.
First, God shielded them from the local populations. He actively prevented the common people from robbing or exploiting them [מצודת ציון, ביאור שטיינזלץ], stopping the masses from harming or exerting any control over the family [אלשיך].
Beyond the everyday threats of the common person, God intervened directly against royalty. He issued severe warnings and brought physical suffering upon kings for the sake of the Patriarchs, ensuring their safety [ביאור שטיינזלץ, מצודת דוד, מאירי]. The primary approach among commentators is that these rulers were Pharaoh of Egypt and Abimelech of the Philistines, both of whom God struck with plagues to protect Abraham and Sarah.
Although these direct physical punishments occurred during the life of Abraham, their protective effect spanned multiple generations. The harsh lesson taught to Abimelech served as a powerful, lingering deterrent that later stopped him from harming Isaac and Rebecca [מצודת דוד]. Broadening this scope of royal protection, an additional perspective includes the experiences of Jacob. When Jacob was pursued by Laban the Aramean—who is considered a king in Rabbinic tradition—God personally intervened to warn him, extending this same divine shield to the next generation [אלשיך].