As luck would have it, one of the major obstacles to the terraforming of Mars is the deeply toxic nature of its soil (or rather, regolith) caused by an abundance of perchlorates.
From the paper, Perchlorate on Mars: a chemical hazard and a resource for humans
Perchlorate (ClO4−) is widespread in Martian soils at concentrations between 0.5 and 1%. At such concentrations, perchlorate could be an important source of oxygen
Extraction and refinement of oxidising salts by stripmining the regolith might, in fact, provide a means to burn coal. This will of course consume energy, but a fleet of solar driven stripminers could harvest oxygen at the same time as extracting other useful minerals from the soil, so the incremental energy cost needn't be punishing.
will people use them as their main source of fuel or there are better alternatives?
It rather depends on the existence of nuclear power... fission or fusion. The former almost certainly requires shipments of nuclear fuel rods from earth, as mining, refining and enriching uranium on Mars itself seems like it would be an enormously expensive enterprise, and probably take quite a long time to get going as well.
Almost any settlement on Mars is going to require some generating capacity to weather dust storms that could prevent the use of solar. Unless fusion has already become practical by the time your settlement is formed, it will almost certainly have a nuclear reactor (though possibly quite a small one).
A coal-fired plant might suffice, given suitable stockpiles of coal and oxygen, but in order to get such stockpiles in the first place requires the sort of infrastructure that almost certainly implies a nuclear powerplant is available. In that case, why would anyone bother burning coal?
No, what seems more likely is that the coal will first be used for scientific purposes, learning about the Martian carboniferous era and the things that lived during it. After that, it could be processed into more complex hydrocarbons eg via coal liquefaction or a coal-to-olefins process (for which I don't have a good link at present).
These hydrocarbons can then be used to create other useful chemicals such as polymers or pharmaceuticals, or perhaps fuels which can then be more efficiently and conveniently and cleanly burnt than coal (such as methanol or ethanol in a fuel cell) or maybe even rocket fuel if that seemed useful still, which rather depends on your tech levels.
Coal-fired heating and power on Mars seems like a last-ditch act of desperation, rather than sensible use of local resources.