As pointed out, there doesn't appear to be an official explanation for this. However, due to several television episodes that show Scotty's penchant for drink (alcohol), plus the habit sailors have for getting very drunk on shore leave, it is quite possible that Scotty was simply talking about a hangover that Bones assisted him in shortening.
I agree with the other posters on here that suggest it alludes to an STD.
The phrase "a wee bout" suggests an infection, not anything drink related, plus the use of the words 'sea dog' and 'shore leave' are usually connected with the old tales of sailors having a girl in every port (and a port in every girl).
I always thought it was just a joke in reference to the fact that Scotty had been persuaded to take vacation time. Maybe it seems more that way in British English but definitely to me the exchange like this made sense:
"You're well?" - just means "how are you doing", seems like Kirk hasn't seen him in a while, which would make sense if Kirk is an admiral ...
Being a Navy engineering vet myself (MM2), "wee bout" and "shore leave" put together suggests a wild night of partying followed by a bad hangover. The STD thing has never jived with me for several reasons:
He's an engineer. We engineer types are reclusive in nature and like to hang out with other engineers (even at the bars), and we ...
I would say that this quote actually works on two levels.
The first level is, I feel, the more obvious one. It is meant to imply that, even at the moment of death, the character (Midshipman 1st Class Peter Preston) is ever the professional. His concern, even then, is for the ship and fulfilling his role. He is still looking to his captain for orders. The ...
I think the scene is a call-back to an earlier one, the one shown around the three-minute mark in this video:
KIRK: Well, Mister Scott, are your cadets capable of handling a minor
SCOTT: Give the word, Admiral!
KIRK: Mister Scott, the word is given.
SCOTT: Aye sir.
Also note the ...
Star Trek: The Motion Picture took place almost a decade earlier than Star Trek: The Wrath of Khan, despite there being only three years between their production; so this is definitely not a reference to anything in ST:TMP.
@TylerShads answer in comments above is one strong possibility -- that this is an oblique reference to Scotty having acquired an STI. ...
Given that Kirk is the only one apparently having sex in the Star Trek universe, it seems more likely that Scotty had some malaise actually from shore leave, like a hangover, dysentery, a broken limb, etc.
In that world, each impairment would be cause for not being on duty, but also trivially and nearly instantly cured by medicine.