
This phrase is a way of telling someone there’s no use in worrying about something that can’t be changed.
The Oxford English Dictionary’s first published citation of a similar phrase is from a 1659 collection of English proverbs by James Howell. He wrote “no weeping for shed milk.”