A. Yusuf Ali:Translation:
So they did take him away, and they all agreed to
throw him down to the bottom of the well: and We put
into his heart 1646 (this Message): ´Of a surety you
shalt (one day) tell them the truth of this their affair
while they know (you) not.´ 1647

Muhammad Asad:Translation:
And so, when they went away with him, they decided to cast him into the dark depths of the well. And We revealed [this] unto him: "Thou wilt yet remind them of this their deed at a time when they shall not perceive [who thou art] !" 16
1646 Allah was with Joseph in all his difficulties, sorrows, and sufferings, as He is with all His servants who put their trust in Him. The poor lad was betrayed by his brothers, and left, perhaps to die or to be sold into slavery. But his heart was undaunted. His courage never failed him. On the contrary he had an inkling, a presentiment, of things that were to be—that his own rectitude and beauty of soul would land him on his feet, and perhaps some day, his brothers would stand in need of him, and he would be in a position to fulfil that need, and would do it gladly, putting them to shame for their present plotting and betrayal of him.
1647 This situation occurred when Joseph later on became the governor of Egypt and his brothers stood before him suing for his assistance although they did not know that he was their betrayed brother; see 12:89 below; also 12:58.