It means that it’s too late now to change what’s happened. It’s an older metaphor that comes from the days when horses were used for transportation, especially to pull vehicles like stagecoaches and carriages. When the horse has left the barn, it’s started its journey and you’re too late to get on it.
Another metaphor that means the same is, “That train has left the station.”