Metal plumbing is supposed to be bonded to the electrical panel for safety and for the longest time it was code to use the plumbing as a ground.

Now that PVC plumbing is more popular and the plumbing can’t be relied on as a ground it is code in most places to have two 8 feet long grounding electrodes outside your house and hooked to your electrical panel for grounding.