In Genesis 40, Pharoah’s cupberarer and his baker have both been thrown in prison for an unnamed offense (the implication of v. 1 is that they were in for the same thing). God gives each of them a dream and then uses Joseph to interpret the dreams. The cupbearer will be restored. The baker will be condemned and put to death.
There are two ways to understand these dreams 1) God is revealing in advance what will happen out of his bare knowledge of events yet to come. 2) God is revealing in advance what will happen out of his sovereign predestining of events yet to come. Which of these is the case is difficult to determine from this passage alone.
The events here related don’t seem to have much bearing on biblical history other than the cupbearer’s forgetfulness of Joseph. So one could conceivably read the story as God’s futile attempt to get Joseph out of the prison by using the dreams to give Joseph an opportunity to perhaps get help from the cupbearer. Sadly, there are many today who would be happy to interpret the story in this way.
But when we consider the many passages where God explicitly shows himself to be sovereign over future events (the Exodus from Egypt comes to mind), it is much more likely that God is showing here how easily he could have released Joseph from prison. If he can determine what will happen to these two officers, then reminding the cupbearer of Joseph’s plight would have been very feasible. The fact that God does the extremely difficult act (from our perspective) of predestining the outcome of the officers and doesn’t do the extremely easy act (from our perspective) of reminding the cupbearer of Joseph, shows that God is making clear here that Joseph is in prison by God’s sovereign plan. And Joseph will remain in the prison as long as it accords with God’s sovereign plan.
A proof of this interpretation is that if it were true that God was trying to get Joseph free by giving the dreams and then using Joseph to interpret them, why did he not do the very simple thing and remind the cupbearer?? The fact is that God is showing Joseph (and us) that he is the one who is in control of everything that is happening to Joseph. In fact, this specific instance from Joseph’s life is only one of a whole string of events that hammer home this theme. Joseph understands this and tells his brothers much later that what they meant for evil, God meant for God (Genesis 50:20).
The application to us is twofold. First of all, the most important event of history, the crucifixion of our Lord, follows this pattern. Jesus was crucified by evil men, and yet they did “whatever your (God’s) hand and your (God’s) plan had predestined to take place” (Acts 4:28). God has always been at work in every event of human history to accomplish his perfect, eternal plan, and the result is our redemption from sin! God’s sovereignty over everything that happens is ultimately for his glory, the revelation of his glorious character, and what we see in that revelation is grace!
The second application is that whatever the Christian sees happening in his life, whether it looks like a blessing (“Hey, the cupbearer is going to spring me from this prison!”) or not (“I can’t believe he forgot about me!”) God is at work to accomplish his good purposes (Romans 8:28).