Genesis 21:2

21:2 So Sarah became pregnant and bore Abraham a son in his old age at the appointed time that God had told him.

Genesis 39:4

39:4 So Joseph found favor in his sight and became his personal attendant. Potiphar appointed Joseph overseer of his household and put him in charge of everything he owned.

Genesis 40:4

40:4 The captain of the guard appointed Joseph to be their attendant, and he served them.

They spent some time in custody.