The novel was based on Hemingway's own experiences serving in the Italian campaigns during the First World War. The inspiration for Catherine Barkley was Agnes von Kurowsky, a real nurse who cared for Hemingway in a hospital in Milan after he had been wounded. He had planned to marry her but she spurned his love when he returned to America. Kitty Cannell, a Paris-based fashion correspondent, became Helen Ferguson. The unnamed priest was based on Don Giuseppe Bianchi, the priest of the 69th and 70th regiments of the Brigata Ancona. Although the sources for Rinaldi are unknown, the character had already appeared in In Our Time.
Biographer Reynolds, however, writes that Hemingway was not involved in the battles described. Because his previous novel, The Sun Also Rises, had been written as a roman à clef, readers assumed A Farewell to Arms to be autobiographical.
Some pieces of the novel were written in Piggott, Arkansas, at the home of his then wife Pauline Pfeiffer, and in Mission Hills, Kansas while she was awaiting delivery of their baby. Pauline underwent a caesarean section as Hemingway was writing the scene about Catherine Barkley's childbirth.
The novel was first serialized in Scribner's Magazine in the May 1929 to October 1929 issues. The book was published in September 1929 with a first edition print-run of approximately 31,000 copies. The success of A Farewell to Arms made Hemingway financially independent.
The Hemingway Library Edition was released in July 2012, with a dust jacket facsimile of the first edition. The newly published edition presents an appendix with the many alternate endings Hemingway wrote for the novel in addition to pieces from early draft manuscripts.
The JFK Library Hemingway collection has two handwritten pages with possible titles for the book. Most of the titles come from the Oxford Book of English Verse. One of the possible titles Hemingway considered was In Another Country and Besides. This comes from The Jew of Malta by Christopher Marlowe. The poem Portrait of a Lady by T.S. Eliot also starts off by quoting this Marlowe work: "Thou hast committed/ Fornication: but that was in another country,/ And besides, the wench is dead." Hemingway's library included both works by Eliot and Marlowe.