Yes, lead can prevent rusting because it will react with oxygen of the atmosphere to form lead oxide, or with carbon dioxide to form lead carbonate, thus preventing the metal surface from being corroded. But since lead is quite toxic, it is not used nowadays. Now more sophisticated methods are available like painting, coating with zinc or copper etc.