I'm not deeply familiar with Godot, but here's my interpretation based on reading the docs:
Many game systems include a concept of "baking" data. The authoring tools might accept a wide range of "raw" asset formats — like png or jpeg — but these are often not ideal for use in the game runtime for various reasons:
Their data layout is different than what the game uses internally (eg. GPUs use specialized compressed formats for rendering)
The workload of converting/recompressing the assets in-game would bloat the runtime and slow down loading the game / levels
Pre-digesting the data lets the game load faster, say by breaking the data into chunks to load only what's needed, or batch loading a group of needed assets in one pass
The raw formats lack metadata information that the game needs to use them as intended
So the authoring tools accept a reference to these raw asset files, and then "bake" them into a form that's efficient for use in the published game. This means the files your game uses at runtime might not be the exact same source files you provided originally.
In Godot specifically, the docs say:
In Godot 3+, image files are no longer native resources and they must be imported. The reason behind this is the large amount of configuration parameters that image files can be imported with.
So, it looks like that's what's happening here. The engine wants to used a baked asset ("imported resource") here, and you're giving it a raw asset ("native resource") like a png.
The error warns you that while this might work in the editor, it won't work in the exported game because the game only knows how to handle baked assets like imported resources;
core/image.cpp:1746 - Loaded resource as image file, this will not work on export: 'res://ball.png'. Instead, import the image file as an Image resource and load it normally as a resource.
So, you can follow this guide to import your image to be able to use it as an imported resource, which should fix the error.