The story
The senses referring to laughing and being afraid are extensions from the literal (urination) sense; both involve an element of variably literal or figurative nature: they are generally figurative, but if one laughs hard enough or gets frightened badly enough, the wetting may sometimes happen literally.
Etymology from Wiktionary, CC BY-SA 4.0.