>>55659224It was actually discussed all the way back in the 90s like in the Pokemon Encyclopedia
>>55658385A few different Japanese materials discuss it, and generally the story is consistent where they were experimenting on a Primate and drugged it to the point of near-death, where it began to curl up into a fetal position and shrink. And seeing that process, they used some of the research and used it in the production of more modern Pokeballs. Essentially, the Pokeballs trigger the Pokemon into biologically responding through electric stimuli (trainers have been hit with the beam, and say they feel like it 'zaps' them)
>>55659230It's implied not to be something they can innately perform. It just triggers at the point of a specific point of exhaustion (partially meant to explain why you can't find Pokemon in a field after knocking them out). Some speculate that attacks like Minimize incorporate the same biological components, but that's just fan interpretation. But when a Pokemon does faint, and shrink, that's it. It's not like they roll around as tiny creatures, when they get the strength to re-awaken, they uncurl into their regular size.
Obviously there are come caveats with this, but this is essentially beta lore that got incorporated as a way to hand-wave questions about gameplay they didn't want to actually design a solution for. It doesn't make a lot of sense, especially with modern lore, but earlier material stated that Pokemon research wasn't even more than a century old and Pokemon just kind of appeared one day and replaced regular animals and that was already being retconned before the anime hiatus from the Porygon incident.