Well, first, consider the number of International Minor League Free Agents signed each year. Many are 16 and 17 years old. This doesn't pertain to the States and the MLB Draft, obviously, where residency or attending institutions hold sway (US, Canada, Puerto Rico or US Territories).
As to the MLB draft, consider a player who has a college scholarship has to weigh the scholarship versus, in most cases, only being eligible after their junior season - OR having turned 21 years of age. Of course, a Ju-Co route would have meant Walling was eligible the following year. But, in general, any high school player who has graduated high school is draft or sign-eligible. If they dropped out, they must have spent at minimum one year post-drop out before being considered eligible.
So, how did it happen? In Walling's case, he weighed his options and chose to become a professional baseball player in the lowest ranks as opposed to collegiate options. He had originally committed (publicly declared at least) to play at Washington State down @ Pullman. He was considered the best outfielder in the state of Washington in 2022.