...it actually means "it is useless to speculate about situations incompatible with the present circumstances," but it's all the same ballpark. Wiktionary has a rather bluntly-titled page
devoted to the adage and similar, of which English has a number, for no readily discernible reason.