A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
gen 39:1JOSEPH IN POTIPHAR'S HOUSE. (Gen. 39:1-23)
Potiphar--This name, Potiphar, signifies one "devoted to the sun," the local deity of On or Heliopolis, a circumstance which fixes the place of his residence in the Delta, the district of Egypt bordering on Canaan.
officer--literally, "prince of the Pharoah"--that is, in the service of government.
captain of the guard--The import of the original term has been variously interpreted, some considering it means "chief cook," others, "chief inspector of plantations"; but that which seems best founded is "chief of the executioners," the same as the captain of the watch, the zabut of modern Egypt [WILKINSON].
bought him . . . of the Ishmaelites--The age, appearance, and intelligence of the Hebrew slave would soon cause him to be picked up in the market. But the unseen, unfelt influence of the great Disposer drew the attention of Potiphar towards him, in order that in the house of one so closely connected with the court, he might receive that previous training which was necessary for the high office he was destined to fill, and in the school of adversity learn the lessons of practical wisdom that were to be of greatest utility and importance in his future career. Thus it is that when God has any important work to be done, He always prepares fitting agents to accomplish it.
gen 39:2he was in the house of his master--Those slaves who had been war captives were generally sent to labor in the field and subjected to hard treatment under the "stick" of taskmasters. But those who were bought with money were employed in domestic purposes, were kindly treated, and enjoyed as much liberty as the same class does in modern Egypt.
gen 39:3his master saw that the Lord was with him--Though changed in condition, Joseph was not changed in spirit; though stripped of the gaudy coat that had adorned his person, he had not lost the moral graces that distinguished his character; though separated from his father on earth, he still lived in communion with his Father in heaven; though in the house of an idolater, he continued a worshipper of the true God.
gen 39:5the Lord blessed the Egyptian's house for Joseph's sake, &c.--It might be--it probably was--that a special, a miraculous blessing was poured out on a youth who so faithfully and zealously served God amid all the disadvantages of his place. But it may be useful to remark that such a blessing usually follows in the ordinary course of things; and the most worldly, unprincipled masters always admire and respect religion in a servant when they see that profession supported by conscientious principle and a consistent life.
made him overseer in his house--We do not know in what capacity Joseph entered into the service of Potiphar; but the observant eye of his master soon discovered his superior qualities and made him his chief, his confidential servant (compare Eph 6:7; Col 3:23). The advancement of domestic slaves is not uncommon, and it is considered a great disgrace not to raise one who has been a year or two in the family. But this extraordinary advancement of Joseph was the doing of the Lord, though on the part of Potiphar it was the consequence of observing the astonishing prosperity that attended him in all that he did.
gen 39:7his master's wife cast her eyes upon Joseph--Egyptian women were not kept in the same secluded manner as females are in most Oriental countries now. They were treated in a manner more worthy of a civilized people--in fact, enjoyed much freedom both at home and abroad. Hence Potiphar's wife had constant opportunity of meeting Joseph. But the ancient women of Egypt were very loose in their morals. Intrigues and intemperance were vices very prevalent among them, as the monuments too plainly attest [WILKINSON]. Potiphar's wife was probably not worse than many of the same rank, and her infamous advances made to Joseph arose from her superiority of station.
gen 39:9How then can I do this great wickedness, and sin against God?--This remonstrance, when all inferior arguments had failed, embodied the true principle of moral purity--a principle always sufficient where it exists, and alone sufficient.
gen 39:14Then she called unto the men of her house--Disappointed and affronted, she vowed revenge and accused Joseph, first to the servants of the house, and on his return to her lord.
See, he hath brought in an Hebrew . . . to mock us--an affected and blind aspersion of her husband for keeping in his house an Hebrew, the very abomination of Egyptians.
gen 39:20Joseph's master took him, and put him into the prison--the roundhouse, from the form of its construction, usually attached to the dwelling of such an officer as Potiphar. It was partly a subterranean dungeon (Gen 41:14), though the brick-built walls rose considerably above the surface of the ground, and were surmounted by a vaulted roof somewhat in the form of an inverted bowl. Into such a dungeon Potiphar, in the first ebullition of rage, threw Joseph and ordered him to be subjected further to as great harshness of treatment (Psa 105:18) as he dared; for the power of masters over their slaves was very properly restrained by law, and the murder of a slave was a capital crime.
a place where the king's prisoners were bound--Though prisons seem to have been an inseparable appendage of the palaces, this was not a common jail--it was the receptacle of state criminals; and, therefore, it may be presumed that more than ordinary strictness and vigilance were exercised over the prisoners. In general, however, the Egyptian, like other Oriental prisons, were used solely for the purposes of detention. Accused persons were cast into them until the charges against them could be investigated; and though the jailer was responsible for the appearance of those placed under his custody, yet, provided they were produced when called, he was never interrogated as to the way in which he had kept them.
gen 39:21The Lord . . . gave him favour in the sight of the keeper of the prison, &c.--It is highly probable, from the situation of this prison (Gen 40:3), that the keeper might have been previously acquainted with Joseph and have had access to know his innocence of the crime laid to his charge, as well as with all the high integrity of his character. That may partly account for his showing so much kindness and confidence to his prisoner. But there was a higher influence at work; for "the Lord was with Joseph, and that which he did, the Lord made it to prosper."