TL;DR: This is hyperbole: the skewer through the haggis is imagined to be as large as the post of a mill.
For “pin” I found a clear explanation in an old recipe:
Of the Preparation.—Clean out the haggis bag1 very featly;2 haflins3 boil the draught4—the liver a little more, till it be fit for grating; if ye have game it must be haflins roasted; and the eggs boiled hard; dry your oatmeal at the fire till it just begin to be a kything5 brown; grate half the liver, or, in place, mince your game, beef, and other meat, and mix all with the shorn herbs, meal, and spices; and put the whole into the bag with the beef tea, half a mutchkin6 of the draught broth, taken from the lee side of the pot, a little of the ketchup, and a glass or two of the ferintosh.7 Ye may now sew up the mouth thereof taking tent8 to put out all the wind; and for the farther securing the same, ye should put through it a haggis-pin,9 such as “might help to mend a mill in time o’ need,” quoth Burns.
1 Stomach of a sheep. 2 Perfectly. 3 Half. 4 All that hangs about the wind-pipe and gullet, except the lights. 5 A very little. 6 Half an English pint. 7 Highland whisky. 8 Care. 9 A large skewer.
Dominie Sampson (18 October 1823). ‘To Make a Rich Scots Haggis’. In A. F. Crell and W. D. Wallace, eds. (1824), The Family Oracle of Health; Economy, Medicine, and Good Living, p. 155. London: J. Walker. Footnotes renumbered from the original.
The haggis-pin was evidently made of wood:
PRICK, substantive 1. A wooden skewer, securing the end of a gut containing a pudding, Scots. Kelly.† Burns (To a Haggis) uses pin.
John Johnston, ed. (1867). Jamieson's Dictionary of the Scottish Language, p. 407. Edinburgh: William P. Nimmo.
† James Kelly (1721), A Complete Collection of Scottish Proverbs, p. 198: “169. If ever you make a good Pudding, I’ll eat the Prick”.
“Wad” is Scots for “would” (Chambers Scots Dictionary, p. 648).
For “mend a mill” I think that Burns intended a post mill (see photo below): this is a type of windmill in which the body of the mill is mounted on a single vertical post, about which it can turn to present its sails to the wind. So Burns says that the haggis-pin is so large that it could be used to replace the post of a mill. But other wooden parts of a windmill could also work, for example, the stocks.
The reason for taking the line this way is that the exaggeration needs to be on a similar scale to “Your hurdies like a distant hill”, otherwise “mend a mill” would be an anticlimax. (“Hurdies” are buttocks, referring to the shape of a sheep’s stomach, which has multiple lobes.)
Brill windmill, Buckinghamshire. Photo by DeFacto, licensed under CC-BY-SA 4.0.
In comments, the question was raised as to the purpose of the haggis-pin, since this tool is not now commonly employed. Dominie Sampson, quoted above, instructs us to “sew up the mouth” of the haggis bag, not to gather and tie it as is normally done today. However, most haggises are now made in a thin sausage-casing (made of animal intestine or cellulose) and not in a sheep’s stomach, which is much thicker and not so conveniently tubular. Sampson says the pin is “for the farther securing” of the bag, so perhaps the skewer was passed along the seam, like a pin fastening two pieces of cloth. Here are two more accounts with similar explanations:
Then bid your kind gude-man be sure
To shape and scrape a wooden skewer
And carefully adjust that pin
To keep the boiling haggis in
Mrs. Grant (1818). ‘To Mrs W—. Receipt for a Haggis’. In The American Monthly Magazine and Critical Review 2:6 (April 1818), p. 476.
He inquired under what hour of the moon the kale was cut which thickened the broth; whether the wooden skewer, which preserved the rich and luscious contents of the haggis from gushing about the plate, was not of rowan-tree; and if the fat pullet, environed with a garnishing of her own eggs, was not of the breed of the Warlocknowe,—a hen of a far-famed kind which, under a witch's spell, supplied Galloway and Nithsdale with eggs and chickens during a great scarcity.
Allan Cunningham (1826). Paul Jones: A Romance, volume 2, pp. 65–66. Edinburgh: Oliver & Boyd.