A fit is a temporary strong emotional, mental or physical state of some kind. A person might have a fit of gloom, despair, joy, excitement, anger, creativity, enthusiasm, weeping, shivering, yawning, sneezing, epilepsy, religious fervour, etc. The essence of the meaning is that a fit happens suddenly to a person, maybe without warning, and stops after a time, usually short.
We usually describe a fit of this type by naming the type, e.g. 'in a fit of anger, I kicked the cat', but in old fashioned English you can say 'the fit' was 'on' someone, and provide the type of fit by context (in your example it is the ability to shoe horses well).
A musician might say 'I felt suddenly creative yesterday, and while the fit was on me, I wrote three tunes'.
Julius Caesar (a Roman emperor) famously suffered from epilepsy:
He had a fever when he was in Spain, And when the fit was on him, I
did mark How he did shake. ’Tis true, this god did shake.
Cassius in Act 1, scene 2 of Julius Caesar by William Shakespeare
There was a Mohammedan regiment lay next to us at the Pirzai Kotal,
and a priest of theirs—he was, as I remember, a naik — when the fit was
on him, spake prophecies.
Kim (Rudyard Kipling)
fit noun (SHORT PERIOD)
a sudden, uncontrolled period of doing something or feeling something:
a coughing/sneezing fit
She hit him in a fit of anger.
Fit (Cambridge Dictionary)