To be faced with a situation which is pointless, as a successful outcome is impossible. This is usually expressed in terms of a sporting contest in which one of two outcomes is foreseen, either a hiding or nothing. The ‘to’ in the phrase indicates alternative outcomes, as in terms like ‘6 to 1‘ or ‘dollars to doughnuts‘.
The phrase has two applications. One scenario would be that of a team which is expected to win easily but has the betting odds so strongly in its favour that no kudos or reward, that is, ‘nothing’ , would be gained from victory. The other is that of a weak contestant who is expected to be beaten, that is, get ‘a hiding‘.