Genesis 39

1 We do not know how extensive Joseph's emotional upheaval was. Certainly, it was difficult being separated from his loving father and youngest brother, but we do not see Joseph become sullen or despondent. On one hand, he may have been grateful that he was not killed. On the other hand, he still had the prophetic dream that one day he would see his family bow before him. Throughout the rest of his story, we see Joseph as a man of God caught in a difficult circumstance. Throughout his ordeals, he never lost sight of his role in the Will of God.
2 Joseph had learned to fear God from his father, and was probably so influenced by his mother when she was alive. He carried his faith with him to Egypt. His enslavement would be the first of the two main trials of his life. When we fear and trust God, He changes our behavior so that we become productive and peaceable. Although the world may be ungodly, a true act of kindness or a consistently good employee refreshes even "bad" people.
3 God certainly helped Joseph here -- it was evident to all.

It is possible that Joseph wrote this section of Genesis and Moses later edited it into the larger book. Whatever the case, the author does not credit Joseph for the prosperity -- he credits God. In the same way, if we are discussing good work done by others or ourselves we should credit God for giving the ability and opportunity, and allowing it to succeed.

4 Potiphar, like other employers, promotes those who work hard and get work accomplished. Joseph was so good at all kinds of tasks that he quickly became overseer of the household. Now consider that Joseph was not raised as a servant. From what we can gather, he may not have spent much time as a shepherd. Yet, by allowing God to work through him, he could do all these things very well.

Also note that he quickly passed those with "seniority" and perhaps children and other relatives that lived in the household. Yet, we do not hear of any jealousy about this. Everyone seemed to know that Joseph deserved this promotion, and were perhaps happy to work under Joseph's authority. Like Joseph, those who are in positions of authority should foster good working relationships will all those around them.

5 Now this does not say that Potiphar began to fear God. What it says is that God blessed a pagan because a godly man was in his house. In the same way, ungodly people today share in the abundance of blessings that God showers down on His people.
6 Potiphar had complete trust in Joseph even to the point of no longer holding him accountable for how the household was ran. We may never have an employer as trusting as Potiphar, but every Christian should strive to have such a strong work ethic that our employers could leave tasks in our hands with confidence.

Joseph was a very handsome man, just as his mother was a beautiful woman (Gen 29:17). TSK notes, "Joseph's beauty is so celebrated in the East, that a handsome man is frequently compared to him; and the Persian poets vie with each other in descriptions of his comeliness."

A pleasing appearance can be advantageous in human relationships because people are typically attracted to and influenced by good-looking people. However, it can also lead to problems if admirers treasure a handsome appearance over the precepts of God.

7 Unfortunately, not all was well, although everything was going well. Joseph experiences "sexual harassment" on the job. Being a godly man, Joseph refuses his boss' wife's advances. However, as a slave, Joseph had limited options with which to handle this situation. He could not quit his job. He could not go to his boss and say, "your wife keeps asking me to have sex with her." He did do some smart things. First, he tried to avoid being alone with her. Second, he ran away from her presence when he was trapped.
8 Joseph tried to reason with her. He was in charge of everything, but this did not give him rights to his boss' wife. Even more importantly, Joseph was accountable to God, and sex outside of a proper marriage was detestable in God's eyes.
10 We do not know how long this went on, perhaps weeks or months. Her infatuation turns to obsession and she is very persistent. Potiphar never catches on, and was probably often absent with duties in Pharaoh's court.
11 Finally she finds an opportunity to trap Joseph, but he escapes.
14 Now she was angry and humiliated. She would get revenge on Joseph (although he did nothing wrong), and she knew that she could get away with it. She first riles up the others in the household by pointing to Joseph's ethnic differences. It is unfair and prejudice to generalize personalities of those who are socially, religiously, or ethnically different from oneself. People should be weighed by their own merit. Anyway, the woman then flips the characters of the story so that Joseph appears to be the sexual predator.
15 This was a case where the material evidence was interpreted incorrectly.
19 Potiphar felt betrayed by Joseph because he did not know of his wife's duplicity. Joseph apparently did not defend himself. It was her word against his, and he knew he could not win. He was a foreigner and a slave with no legal rights in Egyptian society.
20 Potiphar could have had Joseph executed for the charge of attempted rape, but he instead chose to imprison him. He may have later found out that the charge was false but had to punish Joseph to preserve his wife's reputation. Another possibility is that Potiphar had great respect for Joseph, and since the rape was not consummated felt that it would have been a travesty to have him executed. Whatever Potiphar's motivation, we can be certain that God intervened and gave Potiphar sympathy for Joseph.

Potiphar was in charge of the royal guard, and thus he had the "privilege" of placing Joseph in the king's prison. This may have had some advantages compared to public prisons.

21 We rarely know why bad things happen to good people. Bad things happen to everyone. Sometimes God protects us, and other times He allows us to go through a trial or even to die. However, whatever the circumstances, we should continue to trust God because we are convinced that all things eventually work out for the good (Rom 8:28).

Joseph was now in prison, and his reputation was ruined. The Bible does not say whether an execution was planned, but given the length of Joseph's imprisonment it appears unlikely. It is unusual that a foreign slave would "spend time" at taxpayer expense rather than be executed.

Even under the worst circumstances, God can cause people to prosper. When we let Him work through us, good work will result. God will also help the right people to see us at the right time. While it is implied that God gave Joseph sympathy in the eyes of Potiphar, it is explicitly said that He intervened and gave Joseph favor in the eyes of the warden.

22 The warden quickly saw that Joseph was a good and intelligent worker.
23 The prison keeper had implicit and unquestioning trust in Joseph. Joseph did everything right, and would not even give the appearance of doing anything wrong.

I do not know how an ancient prison may have "prospered," but with God, anything is possible. When we are in situations that appear insignificant or without possibilities, we should trust in God. He might make something happen.

It is ironic that a prisoner was running the prison. The fact is that there was probably no other person in all of Egypt honest enough to do such a good job.