This is a good question which can be applied to many situations in the Bible.  How did Moses write about the creation of the world in seven days if he was not there?  How did John write the book of Revelation, revealing so many future events, when they would not happen for centuries?

This simple answer is that the Lord led these different men to write. 

  • 2 Peter 1:21 tells us, “For the prophecy came not in old time by the will of man: but holy men of God spake as they were moved by the Holy Ghost.”  This shows how the Lord, through the Holy Ghost, told the inspired writers what to say and commit to paper.  As you can see, this some time involved given the different writers knowledge they did not learn from any other source other than the inspiration of God.
  • 2 Timothy 3:16-17 assures us, “All scripture is given by inspiration of God, and is profitable for doctrine, for reproof, for correction, for instruction in righteousness: That the man of God may be perfect, throughly furnished unto all good works.” This lets us know that ALL the scriptures, from Genesis to Revelation was ‘God-breathed’ and therefore is accurate, trustworthy, and completely perfect in the original manuscripts.

Sometimes the Lord spoke directly to men, telling them what to write as we have in Jeremiah 36:2, “Take thee a roll of a book, and write therein all the words that I have spoken unto thee against Israel, and against Judah, and against all the nations, from the day I spake unto thee, from the days of Josiah, even unto this day.”

Luke, who never met the Lord Jesus in person, was given understanding and knowledge of the events in the life of the Lord Jesus.  He wrote, “Forasmuch as many have taken in hand to set forth in order a declaration of those things which are most surely believed among us, Even as they delivered them unto us, which from the beginning were eyewitnesses, and ministers of the word; It seemed good to me also, having had perfect understanding of all things from the very first, to write unto thee in order, most excellent Theophilus, That thou mightest know the certainty of those things, wherein thou hast been instructed.” (Luke 1:1-4).  

I appreciate John MacArthur’s comments on how the Lord inspired particular men to write the scriptures.  He wrote, “As those godly men were carried along by the Holy Spirit, He superintended their words and used them to produce the Scriptures. As a sailing ship is carried along by the wind to reach its final destination, so the human authors of Scripture were moved by the Spirit of God to communicate exactly what He desired. In that process, the Spirit filled their minds, souls, and hearts with divine truth— mingling it sovereignly and supernaturally with their unique styles, vocabularies, and experiences, and guiding them to produce a perfect, inerrant result.” (From the book, Strange Fire).

It is important that we understand that the Lord used men to give us a message from Himself.  He used imperfect men to give us His perfect word.  As in the case of your question, the Lord allowed these men the knowledge they needed to write the words He wanted us to read, so that we might have understanding.  We may rest assured that the scriptures are historically, scientifically, prophetically, and spiritually correct because God inspired holy men to write His Word…even if they wrote about things they were not eyewitnesses to. (CC)  (735.4)