Wood hardens with age. After a period of time, you can't drive nails in some types. A carpenter might call such wood "harder than nails".
The term could be applied to many other materials that harden with age, often as an exaggeration; often food.
hard, stale, inedible
Those left-over biscuits are harder than nails.