I never encourage deceit, and falsehood, especially if you have got a bad memory, is the worst enemy a fellow can have. The fact is, truth is your truest friend, no matter what the circumstances are.

Abraham Lincoln (1809–1865) American lawyer, politician, US President (1861–65)
Letter (1842-02-22) to George E. Pickett (forgery)
    (Source)

This appears to be the connection between Lincoln and sayings such as:

  • "No man has a good enough memory to make a successful liar."
  • "To be a successful liar one must have a good memory."
The sentiment itself was proverbial when Quintilian mentioned it in AD 95 in his Institutio Oratoria, reinforced by Montaigne in 1572.

The origin of the specific quote are the various biographical sketches done of Confederate General George E. Pickett by his wife, LaSalle "Sally" Corbell Pickett. According to her, Lincoln wrote this letter as advice to the young Pickett who had just won (through Lincoln's assistance) appointment to West Point (class of 1846).

She recounted this story in her book Pickett and His Men, ch. 16 (1899). She repeated it in various publications during her life, including:

In her book What Happened to Me: A Confederate Wife's Memoir, ch. 19 (1917), Pickett says her husband related the story to her in the closing days of the Civil War. She later claimed to others, like Ida Tarbell, that while she had seen the actual letter, the original had been destroyed in a fire.

The quote is also referenced in:

  • John Nicolay and John Hay (ed.), Complete Works of Abraham Lincoln, Vol. 12, "Anthology of Sayings of Abraham Lincoln" (1894) -- present in an abbreviated form.
  • Ida Tarbell, The Life of Abraham Lincoln, Vol. 2, Appendix (1895; 1900 ed.) -- she notes "original owned by LaSalle Corbell Pickett. Extracts published in Pickett and His Men (1899)." Sally Pickett sent Tarbell a transcription of the letter, which Tarbell accepted. Pickett used Tarbell's bestselling work (first published in McClure's Magazine) to give the story credibility.
  • Arthur Lapsley (ed.), The Writings of Abraham Lincoln, Vol. 1 1832–1843 (1905)
Modern Lincoln scholarship tends to consider the letter a fake, one of many forged by Sally Pickett. Lincoln scholar Roy P. Basler identified it as a forgery (e.g., The Collected Works of Abraham Lincoln, Vol. 8, Appendix 2). In various works, he noted there was no authenticated original manuscript (Sally Pickett claimed the original had been lost in a fire), and that Sally Pickett had only written of it decades after the war (1899). The letter was written in far more flowery a tone than Lincoln's actual writing at the time and, further, the letter to Pickett was supposedly dated in late February, but Pickett had already entered West Point as a cadet in January.

The intent seems to have been to posthumously improve the reputation of her husband by showing a relationship (which, if it existed, would have been distant) between George Pickett and Lincoln. This, and promotion of the "Lost Cause" trope, took up much of Pickett's time after her husband's death, and she has been shown to be an unreliable narrator and forger of documents.