"After two whole years, Pharaoh [see Egypt's Royal House] dreamed that he was standing by the Nile [see The Nile River, also The Nile Delta], and behold, there came up out of the Nile seven cows sleek and fat, and they fed in the reed grass. And behold, seven other cows, gaunt and thin, came up out of the Nile after them, and stood by the other cows on the bank of the Nile. And the gaunt and thin cows ate up the seven sleek and fat cows. And Pharaoh awoke." (Genesis 41:1-4 RSV)
Joseph had by that time been wrongly imprisoned for over "two whole years." He had demonstrated his God-given ability to reveal the meaning of dreams to The Pharaoh's Chief Butler, who only years later made an effort to help free an innocent man just as the butler himself had been freed.
"Then the chief butler said to Pharaoh, "I remember my faults today. When Pharaoh was angry with his servants, and put me and the chief baker in custody in the house of the captain of the guard, we dreamed on the same night, he and I, each having a dream with its own meaning. A young Hebrew was there with us, a servant of the captain of the guard [i.e. Potiphar]; and when we told him, he interpreted our dreams to us, giving an interpretation to each man according to his dream. And as he interpreted to us, so it came to pass; I was restored to my office, and the baker was hanged."
Joseph's abilities greatly impressed the Egyptian king; Joseph was not only liberated, he was made the Prime Minister of Egypt, second only to the pharaoh himself. The famine came just as Joseph said that it would, but Egypt had been warned and prepared itself.
"Joseph was thirty years old when he entered the service of Pharaoh king of Egypt. And Joseph went out from the presence of Pharaoh, and went through all the land of Egypt. During the seven plenteous years the earth brought forth abundantly, and he gathered up all the food of the seven years when there was plenty in the land of Egypt, and stored up food in the cities; he stored up in every city the food from the fields around it. And Joseph stored up grain [see Corn] in great abundance, like the sand of the sea, until he ceased to measure it, for it could not be measured." (Genesis 41:46-49 RSV)
Joseph also married at that time, from which two sons were born (see Ephraim and Manasseh).
"Before the year of famine came, Joseph had two sons, whom Asenath, the daughter of Potiphera priest of On, bore to him. Joseph called the name of the first-born Manasseh, "For," he said, "God has made me forget all my hardship and all my father's house." The name of the second he called Ephraim, "For God has made me fruitful in the land of my affliction." (Genesis 41:50-52 RSV)
Genesis Chapter 42
The land of Israel was not as prepared for the long famine as Egypt had made itself. Jacob sent some of his sons to buy food from The Grain Merchant of Egypt.
"When Jacob learned that there was grain in Egypt, he said to his sons, "Why do you look at one another?" And he said, "Behold, I have heard that there is grain in Egypt; go down and buy grain for us there, that we may live, and not die."
Genesis Chapter 43
Joseph did not identify himself to his brothers, at first. He treated them, not harshly, but justly, considering what they had done to him, having sold their own brother into slavery, and then causing terrible grief to their father Jacob / Israel by telling him that Joseph had been killed (see Coat Of Many Colors).
"Now the famine was severe in the land. And when they had eaten the grain which they had brought from Egypt, their father said to them, "Go again, buy us a little food."
"And he lifted up his eyes, and saw his brother Benjamin, his mother's son, and said, "Is this your youngest brother, of whom you spoke to me? God be gracious to you, my son!" (Genesis 43:29 RSV)
Genesis Chapter 44
Joseph wasn't finished with his treacherous older brothers yet however.
"Then he commanded the steward of his house, "Fill the men's sacks with food, as much as they can carry, and put each man's money in the mouth of his sack, and put my cup, the silver cup, in the mouth of the sack of the youngest, with his money for the grain." And he did as Joseph told him."
It had been Judah's idea to sell Joseph into slavery, rather than kill him (Genesis 37:26-28). It was Judah who attempted to save the young Benjamin from prison.
"Then Judah went up to him and said, "O my lord, let your servant, I pray you, speak a word in my lord's ears, and let not your anger burn against your servant; for you are like Pharaoh himself." (Genesis 44:18 RSV)
Fact Finder: Centuries after the time of Joseph, how did the famous Cleopatra become the ruler of Egypt?