How do I download Mac OS Sierra or High Sierra without an Apple ID?
You can't, the Mac App Store naturally requires an AppleID and entering it is just part of the process to verify the user.

I can really only think on one way and that is to get a friend who has downloaded the installer to give it to you as a file or a portable USB installer, more on that here.
I am sure you have a valid AppleID, else just create another one, as it is much less complicated to just go the "standard" way and enter one if it prompts for one, than to have to worry about the legitimacy of other sources.

So to sum up, there is an option in the System Preferences' App Store tab to decide when to prompt for a password. This may be what you are looking for. Else the answer is no, as Apple likes to know who it's software goes to.
I hope that helps, please let me know if you require clarification.