The bones and the series of ligaments that form the knuckles and many other joints have a little elasticity.
In cracking a joint, what basically happens is that you separate the two bones by pulling or bending. This abruptly creates a space between the bones, a vacuum.
Then the fluids normally present in the surrounding tissues rush into that space with the sound of a tiny explosion.
The fluid is gradually reabsorbed, so there is a time lag before that joint can be cracked again.
Knuckle cracking is apparently innocuous except for being obnoxious.
The joint that is usually cracked, the one between the hand and the finger, is typically spared from wear-and-tear arthritis, or osteoarthritis.