Although cows are always milked twice a day, mornings and evenings, the very old homely saying “till the cows come home” refers to the time that cows, with udders painfully full, come to the home gates for the morning milking.
The saying, used as long ago as 1600, seems at first to have always indicated disgracefully late hours, mostly hours spent riotously; but Swift, in 1738, applied it to time spent by a slugabed who did not arise before the evening milking:
“I warrant you lay abed till the cows came home,” he wrote in Polite Conversation.
The amplified expression, “Till hell freezes over and the cows come skating home over the ice,” is very modern.