Lots of of abrasives. Electrolytes from the batteries won't soak into the iron, and lithium is not soluble in solid iron if they happened to be lithium batteries. If you can get all the plastic completely removed, the chemicals from the battery are water soluble so it will just wash off.
EDIT:
Depending on your battery type, you might want to dispose of the pan. If alkaline batteries were used, be aware that the electrolytes from the battery are caustic. They can cause tissue damage(topical burns), which should be treated with soap and water.
Either way, cleaning the pan could be dangerous, and you might consider throwing it out completely, because of the precautions you'd need to take. However the pan should not have suffered any corrosion from the battery, metal is non reactive with a base, and there is no compound in a alkaline battery that is reactive with metals. You can confirm this via the MSDS for most batteries. KOH is the only chemical that is corrosive, but its not corrosive to iron. In fact KOH is commonly used to clean cast iron, because it will corrode everything but the iron.