Writing for Popular Science, Philip Kiefer describes what archeological evidence shows from some of the earliest known prehistoric settlements in Turkey. These date from the period when hunter-gatherer humans were first experimenting with agriculture.
That evidence suggests hunters captured young wild sheep and goats, likely while killing their mothers, and kept them penned to eat later. Apparently they weren't very successful at this, but over time discovered basic animal husbandry by trial and error.
Eventually, the animals came to rely on the humans and domestication occurred, more or less by accident the archeologists surmise. Hat tip to Instapundit for the link.