The genetic and physiological origins of laughter?
I recommend this article: The Evolution and Functions of Laughter and Humor: A Synthetic Approach by M Gervais and DS Wilson, 2005, University of Chicago Press.

For your question about the origin, firstly they explain that all laughter is induced by stimuli which are unexpected or unpredictable, experienced in a non-serious (unthreatening, safe) context. Given examples include peek-a-boo, which can make a child laugh but also cry if the child is not perceiving the situation as safe. Also that we can't tickle ourselves and tickling is induced by stimulating vulnerable body areas. Similarily, apparently in apes laughter is mainly induced by "tickling in conjunction with mock aggression and chasing".

They explain the function of (Duchenne, that is stimulus-driven "honest" as opposed to voluntary) laughter to be propagation of "positive affect" in a group, as it utilises the chameleon effect (it is contagious) which apparently has been shown to exist for its "cooperative value". Other studies seem to have shown that a) we are thirty times more likely to laugh in a social context than by ourselves and b) the contagiousness of laughter response increases with group size, making it an efficient tool for coordinating a group and getting everyone into the same emotional state.

As for other animals, the article doesn't address that. It does seem like a different question to me so I would consider separating that into a second one.