Today’s saying comes from the glorious days of prize fighting.
The earliest prize fights took place outdoors in roped-off areas in fields. The contestants had their own corners and people looking after them called seconds, as they do today. But one difference was that at the start of the fight, and also when resuming after a knock-down (which was the only way a round ended in those days), the fighters were obliged to make their way to a line scratched into the grass in the centre of the ring by the referee using the heel of his boot.
If a fighter took so much punishment that he could no longer make his way to the mark after a knock-down, he was not up to scratch.
Up to scratch