Natural sandblasting has hollowed out the softer sandstone and left the resistant bands of ironstone standing to give a Swiss cheese effect to this block in an old sandstone wall.
Iron-rich deposits can be precipitated as a scummy layer where a river meets salt water in an estuary. Perhaps that happened 300 million years ago when this sandstone was laid down.
Without knowing exactly what happened, you can still sometimes deduce the sequence of events. Sometimes a rolled pebble – a mini-Swiss roll of ironstone – suggests that a layer of iron had begun to form on a river bed but that it was rolled away by the current before it got covered by the next pulse of sediment.
In other cases, target-shaped nodules conspicuously cut across multiple layers of sandstone, suggesting that the layers came first and that the iron precipitated out as mineral-rich solutions percolated through the sediment.