Yes in most places you can legally turn a portable shed into a house.
Portable sheds do not usually require any permits to install on your property as they are built on skids and delivered and setup.
However if you do live in a city or town then they may have restrictions on housing and they may not allow a portable shed to be turned into a house on your property.
However if you live in a rural area or a wooded property somewhere then yes you can legally and easily put a portable shed on the property and then turn it into a shed.
You can wire the shed, build a bathroom, kitchen, bedroom and install plumbing etc in the portable shed to make it into a livable house.
I plan to do the same thing when I hopefully move to a rural property in Arkansas in a few years or so.
I want to get me a small portable shed and then turn it into a small one bedroom house for myself.