Asteroids in Starmade are randomly generated rocks that generate in space. There’re many types of asteroids, containing many different minerals. They follow the same basic rule of generation that planets follow, meaning, for example, you won't find lava on an ice asteroid, etc. To see more on planet generation, see the page.
Asteroids can be particularly useful for early game mining due to their proximity to your spawning location and masses of easily accessibly minerals. In late game they can also be used if your need something for a factory recipe, as many types of asteroids can exist within a short range, allowing for many types of minerals to be easily accessible.
Asteroids, as stationary objects in space, can be used as space stations and are especially useful early game when you don't have the money or resources to build a full station. Instead you can just take over an asteroid and use it temporarily for factories, as a spawn point or even for docking. To see more on stations and their uses, see the page.