Because of a form of martial law that has been in place since 1862 or so, and also because of the martial law and prosecution of war factors extending from 1942 (i.e. WWII). UNITED NATIONS government. Geneva Conventions, friend-foe-identification. Isn't it lovely that total strangers can get in or start a fight (or we can get fancy and call it 'war') to the extent that people not even involved are coerced into carrying some kind of evidence of their non-involvement. And that is modern civilization?
Also, the failure of government fiduciaries to adequately police borders then gives rise to a "need" to "stop and identify" in case you are someone they failed to keep from crossing "the border" "illegally".
Oh and another thing, in case a government fiduciary allowed someone to escape prison or in case you are a parollee on probation restricted to this or that behavior or conduct--ya know, lots of things that have necessarily anything to do with you or me but which are someone else's problem made into "your problem" (i.e. carry documentation to show you aren't someone else?).
Also, abolition of the death penalty and early paroles means a 'mingling' which again someone else's problem turning into a 'need' or 'requirement' for 'identifying yourself'.
It should all become very clear to you if you consider that:
1 - A ship sailing without a flag is regarded to be subject to seizure (pirate ship)
2 - An automobile without license plates or a USDOT number is regarded to be subject to seisure too (pirate ship).
(Navy Regulations on land....)