Tolkien didn't have a writer's retreat or a quiet cabin. He had a professor's study in North Oxford, packed with books, maps, and towers of exam papers, and that's where most of Middle-earth got written. The book's live audience sat somewhere else, in a pub full of friends who wanted the next chapter.

The Direct Answer
In his cluttered home study in North Oxford, with the Inklings hearing it read aloud at the Eagle and Child pub.
The first line of The Hobbit was scrawled on a blank leaf while he sat marking exam papers at that desk, per his 1955 letter to W.H. Auden (Letters, No. 163).

The Study at Northmoor Road

From 1930 to 1947, Tolkien lived at 20 Northmoor Road in North Oxford, and that study saw most of the writing of The Hobbit and The Lord of the Rings. It was a working room rather than a showpiece, stacked deep with student scripts, reference books, and the drawings and maps he made as he went. He wrote at his desk there, usually at night, in a house where a wife and four children were asleep upstairs. In 1953 the family moved to 76 Sandfield Road in Headington, where he finished preparing the trilogy for print.

All I remember about the start of The Hobbit is sitting correcting School Certificate papers... On a blank leaf I scrawled: 'In a hole in the ground there lived a hobbit.' I did not and do not know why.

J.R.R. Tolkien, The Letters of J.R.R. Tolkien, No. 163

The exam papers weren't incidental. Marking School Certificate scripts was how underpaid Oxford dons topped up a thin salary, and Tolkien did stacks of it every summer. One year, on a blank page in that pile, he wrote the sentence that started everything. The most famous opening line in fantasy came out of the most tedious chore on his calendar.

The study worked as a kind of external memory. Drafts, letters, maps, and half-finished drawings covered every surface, and Tolkien moved through the mess with the ease of someone whose thinking was spread across the whole desk. He drew the maps of Middle-earth in that room too, redrawing them whenever the story shifted a distance or moved a river, so the geography and the prose kept correcting each other in the same few square feet.

The Eagle and Child

The second place that shaped the book was for reading it out loud. The Inklings, an informal circle of Oxford writers and dons, gathered at the Eagle and Child pub on St Giles' Street, nicknamed the Bird and Baby, and on Thursday evenings in C.S. Lewis's rooms at Magdalen College. Tolkien read the new chapters to them as the book grew. Lewis kept pushing him to finish, and Tolkien said afterward that without that encouragement the book might never have been done.

For the daily rhythm inside that study, see the full J.R.R. Tolkien writing routine.

What You Can Steal