Egypt enters the biblical narrative prominently in Genesis 12 when Abraham travels there during famine. Its greatest Genesis role comes in the Joseph narrative. Joseph is sold into Egypt, rises to authority under Pharaoh, and ultimately brings Jacob and his family into Egypt during a severe famine.
Exodus describes a later Pharaoh enslaving the Israelites and ordering the death of Hebrew male children. God calls Moses to lead Israel out of Egypt, bringing the plagues, Passover, crossing of the sea, and liberation that become foundational events in Israel's identity.
Egypt remained an important political neighbor throughout the monarchy. The prophets alternately describe Egypt as a political temptation, an unreliable ally, and a nation subject to God's sovereignty. Matthew 2 later records Joseph taking Mary and Jesus into Egypt to escape Herod.