In the 1920s Hemingway lived in Paris, was foreign correspondent for the Toronto Star, and traveled to places such as Smyrna to report about the Greco–Turkish War. He wanted to use his journalism experience to write fiction, believing that a story could be based on real events when a writer distilled his own experiences in such a way that, according to biographer Jeffrey Meyers, "what he made up was truer than what he remembered".
With his wife Hadley Richardson, Hemingway first visited the Festival of San Fermín in Pamplona, Spain, in 1923, where he became fascinated by bullfighting. The couple returned to Pamplona in 1924—enjoying the trip immensely—this time accompanied by Chink Dorman-Smith, John Dos Passos, and Donald Ogden Stewart and his wife. The two returned a third time in June 1925. That year, they brought with them a different group of American and British expatriates: Hemingway's Michigan boyhood friend Bill Smith, Stewart, Lady Duff Twysden (recently divorced), her lover Pat Guthrie, and Harold Loeb. In Pamplona, the group quickly disintegrated. Hemingway, attracted to Lady Duff, was jealous of Loeb, who had recently been on a romantic getaway with her; by the end of the week the two men had a public fistfight. Against this background was the influence of the young matador from Ronda, Cayetano Ordóñez, whose brilliance in the bullring affected the spectators. Ordóñez honored Hemingway's wife by presenting her, from the bullring, with the ear of a bull he killed. Outside of Pamplona, the fishing trip to the Irati River (near Burguete in Navarre) was marred by polluted water.
Hemingway had intended to write a nonfiction book about bullfighting, but then decided that the week's experiences had presented him with enough material for a novel. A few days after the fiesta ended, on his birthday (21 July), he began writing what would eventually become The Sun Also Rises. By 17 August, with 14 chapters written and a working title of Fiesta chosen, Hemingway returned to Paris. He finished the draft on 21 September 1925, writing a foreword the following weekend and changing the title to The Lost Generation.
A few months later, in December 1925, Hemingway and his wife spent the winter in Schruns, Austria, where he began revising the manuscript extensively. Pauline Pfeiffer joined them in January, and—against Richardson's advice—urged him to sign a contract with Scribner's. Hemingway left Austria for a quick trip to New York to meet with the publishers, and on his return, during a stop in Paris, began an affair with Pauline. He returned to Schruns to finish the revisions in March. In June, he was in Pamplona with both Richardson and Pfeiffer. On their return to Paris, Richardson asked for a separation, and left for the south of France. In August, alone in Paris, Hemingway completed the proofs, dedicating the novel to his wife and son. After the publication of the book in October, Richardson asked for a divorce; Hemingway subsequently gave her the book's royalties.