As a British English speaker, and having grown up near Sherwood Forest, where, legend has it, Robin Hood lived with his "Merry Men", I have never heard the phrase: it seems to be American.
https://wordhistories.net/2018/12/05/robin-hoods-barn/ gives:
"The earliest known use of Robin Hood’s barn is from a letter written in 1797 by the American book agent and author Mason Locke Weems (1759-1825)—I could not determine whether he used the phrase literally or figuratively, as I could not consult the letter:
[as quoted in the Oxford English Dictionary (3rd edition, 2010)]
1797 M. L. Weems in P. L. Ford Mason Locke Weems (1929) II. 77 I can sell them abundantly fast without the trouble of going round Robin Hood’s barn.
Phrases.org has this credible explanation at https://www.phrases.org.uk/bulletin_board/5/messages/1405.html
ALL AROUND ROBIN HOOD'S BARN - "Robin Hood (or 'Robert of the wood,' as some have explained the name) may have been altogether a legendary figure or may have actually existed. No one knows. The earliest literary reference to him is in Langland's 'Piers Plowman,' written about 1377. He may have lived, according to some light evidence, toward the latter part of the twelfth century. But Robin Hood's house was Sherwood Forest; its roof the leaves and branches. His dinner was the king's deer; his wealth the purses of hapless travelers. What need had he of a barn, and how was it laid out if to go around it means, as the use of the phrase implies, a rambling roundabout course? The explanation is simple. He had no barn. His granary, when he had need of one, was the cornfields of the neighborhood. To go around his barn was to make a circuitous route around the neighborhood fields." From "A Hog on Ice" (1948, Harper & Row) by Charles Earle Funk. This is one in a series of four books by Mr. Funk now available in one volume.
(My reading of this is that Sherwood Forest itself was "Robin Hood's Barn" as it was where everything that Robin Hood needed was kept.) The article continues with a demonstration that "Robin Hood's barn" can be replaced by any place that was a long way away from the intended end point. This supports Spagirl's comment above.
The article continues:
Here's a colorful phrase known only to folks around Raleigh County in southern West Virginia: "I had to go all the way to Egery and back to get that." "Egery" referring to Egeria, a little community WAY out in the country close to Flat Top, West Virginia.