Generally speaking, you have a very little bit of ore for the mineral you want mixed in with a lot of unwanted rock. For example, solid nuggets of relatively inert metals (like gold) larger than a few grams are extremely rare - and it's harder for more reactive types, and the rock generally must be ground up, filtered, smelted, or otherwise processed.
Of course, Star Trek transporters are able to scan and replicate at the quantum level, but we only ever seem to see them used to move large, contiguous objects (people, cargo containers). We certainly don't see lots of extremely small objects being selectively transported. This probably means that extracting only the wanted mineral from surrounding rock is technically prohibitive.
Also - it is unclear how broad access is to transporter technology. Most Federation ships we do see in Star Trek are Starfleet, and so we would expect transporters. But quite a few non-Starfleet ships do not appear to have their own transport system and require docking/landing (such as the miner's ship in Final Mission).