In Genesis Chapters 39-41, we can look at the things Joseph suffered - jealousy from his brothers, false accusation from an evil woman, and jail. In those days jails were terrible dungeons with rats, worms and cockroaches crawling all over the place. But it says in Gen. 39:21, that in addition to all those crawling things, "the Lord was also with Joseph". And that made all the difference. It doesn't matter if you are surrounded by every type of inconvenience, if the Lord is with you. That is enough. And that was all that Joseph wanted. There in the jail he meets Pharaoh's cupbearer and thus gets an introduction to Pharaoh. You see how God's plan begins to work out slowly. It's not just that God protected Joseph from the evil that Potiphar did to him. He made the evil that Potiphar did to him to work out God's perfect plan. How would Joseph have ever met Pharaoh's butler and got an introduction to Pharaoh if he hadn't gone to that jail?!!
I want you to notice how Joseph came into contact with Pharaoh's cupbearer. Joseph had enough problems of His own to worry about in prison. But he forgot about his own sorrows when he saw two newcomers to the prison looking sad one day. Joseph had been appointed by the jailer to be in charge of all the prisoners and so he asked these two prisoners the reason for their looking so dejected (Gen.40:7). That was how he interpreted their dreams correctly and thus got an opening through one of them (the cupbearer) to interpret Pharaoh's dream one day. God has amazing ways of opening doors for His servants who are faithful to Him and who can forget their own sorrows and have a concern for others. That is what we learn from this incident. So let's not be taken up with our own sorrows. Let us open out hearts to other needy people in this world.
Finally Joseph stood one day before Pharaoh. But that was in God's perfect time. The Bible says, "They afflicted Joseph's feet with fetters. But iron entered into his soul during his time in jail. Until the time appointed by God, Joseph was tested. Then God's Word came and set him free" (Psalms, 105:18, 19 - free paraphrase). God is always on time. He is never late. There is a specific length of time fixed by God for all our trials. During that time, He will test us. When that time is over, He will command freedom for us. But by then, if we have been faithful, iron would have entered our soul, and we will have become strong in faith. God turns the tables on Satan and uses the very harm that Satan does to us to strengthen us. Hallelujah!
You know the rest of the story, how his brothers were hungry for food because of the famine in the land, and had to come and bow down before Joseph, exactly as God had shown him 13 years earlier. God keeps His Word. Genesis 43:1 , 2: When the famine was severe in the land, Jacob told his sons to go to Egypt and get some food. Whenever there is a famine anywhere, you have to go and get food from those who were wise before the famine. Joseph was wise in the seven years of plenty. He stored up food. Therefore those who were lazy in the times of prosperity had to come to him now. The Bible says, "Go to the ant, you lazy man, and learn from it - how it stores up its food in summer for the winter." Apply this truth spiritually: In times like these, when you have plenty of opportunity to study God's Word and to become spiritually rich thereby, use your time wisely. Then, many years later when you don't have much time to study the Word, because of the pressures of life, you will have plenty of wisdom to fall back on. The wisdom from God's Word that you store up now will not only satisfy you fully, you will also have plenty to share with others as well.
Let me give you my own testimony. Almost everything that I know of the Scriptures, I studied between the time I was converted (at 19 years of age) and the time I was married (28 years of age). I never went to a Bible school. I studied the Scriptures at the feet of Jesus, in my spare time, while I was working in the Indian Navy. That habit also kept me away from many temptations. It was a time of plenty - because I had plenty of time as a bachelor. Once you get married and have children you won't have that much free time. Go and ask any married person who has children and he will tell you that. So if you are foolish in the years when you have plenty of time, you will regret it in the days of famine. Learn that lesson and apply it to yourself.
Joseph dealt with his brothers in a godly way. In Genesis 45:5 he says, "It was God who sent me before you." Again in Genesis 45: 7, he says, "God sent me before you." And once again in Genesis 45: 8 "God sent me." He was telling his brothers, "It was not you who sold me to the Ishmaelites, it was God. It was not Potiphar's wife who sent me to the jail, it was God." Blessed indeed are we if we can see God in all our ways - even in the evil that others do to us. Have you seen this glorious truth? Don't ever say, "This person is harming me" or "That person is harming me." It is God Who allows people to do things to you. Joseph prepared a great feast for his brothers who had once sold him into slavery. He also gave the best land in Egypt - the land of Goshen - to these brothers who had once prepared a pit for him (46:34)! Such is the attitude of a man of God.
In Genesis 50:20, we hear Joseph saying words similar to what Paul says in Romans 8: "As for you, you meant evil against me. But God meant it for good". This verse is the Romans 8:28 of the Old Testament. God makes all things work together for good for those who love Him.