The life stories of Judah and Joseph are both well-known. Comparing their choices regarding sexual conduct reveals more than their individual histories teach us when read in isolation.
Judah’s voluntary sexual misbehaviour contrasts starkly with Joseph’s refusal to sin sexually even under duress. Judah found himself doubly condemned for condemning Tamar for a sin that he had also committed (Gen 38:26); this challenges the conventional sexual double standard commonly observed in antiquity for men and women. The following contrast with Joseph drives home this point further.
Joseph was attractive (Gen 39:6); the text does not count it relevant whether Potiphar’s wife was also attractive. The text also does not inform us whether Potiphar had given Joseph a female partner, which might befit Joseph’s rank in the household. That may have depended partly on how many of the thirteen years Joseph spent in Egypt before his exaltation (Gen 37:2; 41:46) were spent in Potiphar’s household or in prison; a mate was likelier in the former circumstance than in the latter. The narrator does not inform us whether Joseph struggled with temptation; it is simply clear that he refused to sin against God and against Potiphar. If Potiphar was a literal eunuch (the Hebrew designation for Potiphar in both Gen 37:36 and 39:1 appears to suggest this emphatically), the struggle of Potiphar’s probably younger wife would not be surprising (albeit still a case of sexual harassment). However, the term might simply designate any officer (it appears also in Gen 40:2, 7; compare 1 Sam 8:15; Jer 29:2). In any case, Joseph recognizes that betraying the trust of Potiphar and sinning with his wife would be a sin against God himself (Gen 39:8–9). Joseph’s piety contrasts with Judah’s impiety. For a fuller discussion, see http://www.craigkeener.com/judahs-punishment-in-genesis-38/