In Abraham 2:22-23 the Lord warns Abraham:
And it came to pass when I was come near to enter into Egypt, the Lord said unto me: Behold, Sarai, thy wife, is a very fair woman to look upon;
Therefore it shall come to pass, when the Egyptians shall see her, they will say—She is his wife; and they will kill you, but they will save her alive; therefore see that ye do on this wise:
The idea that God told Abraham this is not found in the Bible, so where did Joseph get it from?
Jeff Lindsay remarks:
The Genesis Apocryphon from the Dead Sea Scrolls (pp. 26-29 in Tvedtnes et al.) indicates that Abraham had a dream which warned him of the threat to his life in Egypt, and of the need to have his wife claim to be his sister (p. 27).– Jeff Lindsay – Questions about the Book of Abraham, Part 3: Does It Agree with other Ancient Texts?
Was this a lucky guess by Joseph Smith?