A hallmark protects you against fraud, and protects merchants against unfair competition. Gold and silver have been mixed with other metals for centuries, as they are much too soft in their original form to make jewellery. It is not possible to recognize at a glance the quantity of cheaper metals used during manufacture. A layer of gold of a couple of microns can seem like real gold when still new. Most competent jewellers and chemists also cannot tell how much of the noble metal is present in an alloy.
Because of the high price of noble metals, some dishonest merchants are tempted to use less valuable alloys. This fraud is difficult to detect, and honest merchants and clients are duped.
There has always been a need to protect the public and suppliers. This is why all objects sold as gold, silver or platinum should be stamped with a hallmark to confirm that they comply with legal norms. That way you can e.g. see what the gold percentage of your white gold jewellery is by looking at the hallmark.