Joseph found himself in Egypts prison for obeying God and resisting temptation. Obedience does not always result in immediate deliverance, however God never leaves his servants, and that is enough for us.