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'.