It's not much more than SpOT's answer, but I'll added the sources.
It's never clearly explained. Rayleigh and Mihawk only mention the overall concept of extending reinforcement Haki to weapons to Luffy and Zorry respectively (Chapter 597 and 779):
After his fight with Pica, Zorry remembers a conversion with Mihawk:
However this idea in manga is not new, and it reminds of how in hunterXhunter Nen can be extended to a weapon if you think about that weapon being an extension of your body (notice Killua mentions "reinforcement"; Chapter 140):