When I’m tempted to sin, it’s very easy to think that my actions are affecting only myself or another person. Joseph clues us in that such is not really the case. When Mrs. Potiphar threw herself at him and tried hard to get sexual favors from him, Joseph’s response was that such sin wasn’t just sin against Mrs. Potiphar or Potiphar himself; the sin would actually be against God. That's always the case when we fail to live up to the standard of righteousness that God sets for us.
The result of Joseph's integrity is both disheartening and encouraging at the same time. It's a good reminder that doing the right thing doesn't necessarily mean that life will be easier. In Joseph's case, he was thrown into prison. Potiphar must not have believed his wife's tale because such actions (had they occurred) would have led to the execution of Joseph. But we know, in hindsight, that God was with Joseph. I'm not sure if Joseph knew that at the time, but he decided that it was more important to honor God with his actions and the consequences than to dishonor God and face a different set of consequences. If nothing else, Joseph wasn't debilitated by his sin the way that others in today's reading were by their own sins.
The encouraging part of the story is this: that God took care of Joseph. I love what I heard Andy Stanley quote his father, Charles Stanley, as saying: "God takes full responsibility for the life wholly devoted to Him." Such was the case with Joseph. God takes responsibility for us, too, when we are wholly devoted to Him.