[When did people first connect sex and] reproduction

That’s less likely in primitive societies where privacy was not a common concept. Everyone knew everyone else’s business. Indeed one theory says speech evolved as gossip replaced grooming as a means of establishing hierarchy, and in a society of hidden fertility, who’s doing whom (or rather, who’s doing her) was a major topic of gossip.

Besides the privacy issue, there were thousands of hunter-gatherer groups at any one time and all of them would have to be following sexual practices that would obscure this basic knowledge. They were not all isolated, there is evidence of trade, there must have knowledge shared between groups, and once you point out as fact that pregnancy requires sex it becomes more difficult to deny it. I’m sure baseless superstitions abounded, but it is pretty easy to see how this works, even if someone still believes in some magical alternative it will become clear this is the basic rule.

As others noted upthread, this might have been easier deduced by absence than presence. It couldn’t have escaped notice for long that women who never had sex never became pregnant.

For a basic answer, by 9,000-10,000 BCE humans had started to breed domestic food/byproduct animals (goats, pigs, & sheep). You don’t go to the effort of breeding domesticated animals unless you understand the basics of reproduction. (And also that one male can fertilize multiple females, thus the excess males are the best ones to cull for food.) So they obviously knew that sex among their breeding animals resulted in the birth of baby animals.

So it would seem that the answer is, at a minimum, about 12,000 years ago in recorded history. But it is probably known even further back, though not proveable.

When they got “the talk”.

But also the only reliable way to secure the labor necessary.

(I think the idea that agricultural societies favor small families is not widely held.)

Yes and no. In doing my family tree (Wiltshire mostly) I see that up until about 1800 the families tended to be 2 or 3 children. Then about 1800 with industrialization, we see families of 4 or 5 then 6 or 8 children. (Many of whom died in the first 5 years).

Another oddity, many of the fathers seem to have started around age 30 - when I assume they took over the primary task of running the farm from their by-then 60-year-old father. Girls, often much younger. Although I did find one wife who was baptised (christened) along with her children and one adult male with the same last name as he maiden name who was born about 20 years after her, and 3 years before she got married… the whole lot were baptised after the husband died. I assume this was something to do with protestant sects of the time…

Also, never underestimate the selfish Y chromosome. A man may be happy to raise his children, but not the offspring of someone else, and particularly not the grandchildren of someone who abandoned his daughter. Sometimes.

Especially not when he’s getting on to grandpa age and the children may not be productive around the farm for another 10 years.

I think domesticating animals was probably when man really started understanding reproduction.
Before that, man was hunting and being hunted. He was living hand to mouth. He had a zillion mysteries to consider, like how to make fire or why hail sometimes falls from the sky or which plants are ok to eat. The days were long, difficult, and exhausting, without a lot of time for reflection. They reacted to life as best they could and wise 90 year old grandpa didn’t exist.
Do other animals “understand” why they’re doing a mating dance or slamming heads together to compete for females or that certain times of year are for mating? Sex is just a biological imperative. Add it to the list of keeping warm, drinking clean water, picking burrs out of your ass before they get infected, and so on. Still, sex feels good and so is worth doing if you have the energy. And when you don’t, you sleep…another activity whose value they didn’t truly understand maybe, but the body obliges.
I think there are a few obstacles to confound primitive understanding. If I’m hungry and I eat, hunger subsides—it’s quick, so cause and effect are more obvious. People have sex…but if it isn’t during the window of fertility or if the sperm isn’t viable, nothing happens. I don’t assume males waited till females were of suitable age, for one thing. Also, only about half of pregnancies don’t go to term.

Under the harsh conditions this scenario, it would have been difficult to see the connection. The old story goes that malaria was so named because they thought it was “bad air” causing the disease, right? But it turned out that the bad air was the symptom of stagnant waters that supported mosquito reproduction and therefore….
I suspect a similar thing here. They kinda noticed something relevant but did they connect the dots in the right way? Probably not. When they domesticated animals they saw a sex-to-birth cycle that is shorter shortened. And if you have a herd of goats you can see they’re all doing it so a pattern emerges. And domestication meant they built shelters, which gave more time to ponder the mysteries of life.

Before writing, so we’ll never know the details.

Like agriculture - the locals knew this in the Americas, so either humans knew this before one group was leaving Siberia over 20,000 years ago, or else they figured it out themselves separately when they got to the new world. Or can we make the same logic apply to Australian aborigines and backdate the discovery to “more than 45,000 years ago”?

It was certainly known to Australian Aboriginal when the first ethnographers came through. Even so, they were generally misrepresented as being so primitive that they did not get the connection, which arose from general racism and also fed later conceptions of ignorance, which is what the OP is trying to disentangle.

Don’t under-estimate the practical and highly detailed biological knowledge that hunter-gatherer cultures develop about the animals and plants that they and their culture relies on to survive. The link between sex -> babies is no surprise. The difference, in the case of Aboriginal people is that it is only part of making a new person. Of equal or greater importance are the spiritual connections which become their at birth - connections to maternal and parental totems and lineages, to dreamtime connections and place-based spirits.

trying to think of an analogy … If the question was ‘Do primitive people know that you get a computer if you go to the store and pay?’ The answer is yes, they completely get it. However, the Aboriginal view is that it is just a bit of empty electronic gear into which the important stuff that makes a walking biped into a human are added - operating system, software, USB gadgets etc are all needed to make it a worthwhile computer as opposed to a stock item in a store. You don’t just buy these at the store, but they are either determined / happen / appear because of broader social processes and the actions of the spiritual realm to create a real entity. Not a great analogy but gets part of the way there.

What, human sex causes human babies? No storks, cabbage leaves, or salamanders are involved? Who knew?!?

Pretty sure that people in hunting-gathering societies spent less time working than people in early agricultural societies. Here’s a modern study on the subject – I don’t have time now to hunt up more references.

And successful hunting/gathering meant knowing a very great deal about the plants and animals that were to be hunted and gathered (as well as about the ones that might hunt or poison you.) It seems to me extremely likely that people who were successful at hunting understood a good bit about reproduction. They would have at least occasionally taken prey who were at various stages of gestation, and between that and swelling human bellies would have figured out that pregnancy takes some time, and could easily have figured out that it takes longer in different species; and they would have known when the rut occured, in species that go in for rut. And they might well have noticed such things as a new male lion in a pride killing the previous male’s cubs; and eventually mounting the female lions; and eventually the appearance of new cubs, who the fathering male was less likely to kill.

Certainly masturbation let them know that the thing going in left something.

Quoting from the article cited:

Co-author, Dr Abigail Page, an anthropologist at the London School of Hygiene and Tropical Medicine, adds: “We have to be really cautious when extrapolating from contemporary hunter-gatherers to different societies in pre-history. But if the first farmers really did work harder than foragers then this begs an important question – why did humans adopt agriculture?”

Indeed, why? Innovations should make our lives easier, but sometimes perceptions don’t mirror reality. Hmm.

I read, years ago, that in such societies the gatherers provided much more sustenance than the hunters. To be fair, a million berries are not a pound of meat—but you still need both categories of food for good nutrition. Hunting is harder so domesticating animals would improve the odds of putting protein on the table. And planting crops meant you beat the bugs to the food if you watched over the farm, maybe.

Did you know that if new males overtake prides, pregnant females will spontaneously abort? Years ago I read that in an ethology text. That whole discipline is incredibly fascinating to me. Did you know that cicadas defend themselves partly by emerging every 17 (prime number) of years to avoid predators?

Sorry, getting off topic. But species do adapt…and it makes sense to me that growing food (be it plant or animal) in your backyard was more dependable than foraging each day.

And I don’t doubt that our ancestors were curious and tried to puzzle out reproduction. But as any couple trying to get pregnant might tell you, even when they tell you up front how it works, it isn’t always simple. Did our forebears get the particulars right?

Another part I would highlight is the time frame. I found this:

Hunting and gathering was presumably the subsistence strategy employed by human societies beginning some 1.8 million years ago, by Homo erectus, and from its appearance some 0.2 million years ago by Homo sapiens. Prehistoric hunter-gatherers lived in groups that consisted of several families resulting in a size of a few dozen people.[9] It remained the only mode of subsistence until the end of the Mesolithic period some 10,000 years ago, and after this was replaced only gradually with the spread of the Neolithic Revolution.

I’d highlight the word “subsistence.” They survived but weren’t fat. 1.8 million years ago to 10,000 years ago is a long span to consider.

13 or 17 years. - Periodical cicadas - Wikipedia

Right. The prime numbers throw off the predators.

Makes a whole lot of logical sense, doesn’t it, to assume that we took up agriculture so that we could eat better and more consistently?

Problem is, it apparently isn’t true. Early farmers (and a lot of later ones), compared to their preceding hunting/gatherers, were stunted and less healthy. And hunter/gatherers apparently weren’t actually more likely to be subject to famines.

So why did we take up agriculture? Possibly because we wanted to be able to stay put. Most hunter/gatherer societies (there are some exceptions) needed to move frequently in order to follow their food supply. They weren’t wandering around randomly, they would have been moving nearly all the time in known territory according to familiar patterns; but most of them still needed to move, as both animals and food plants were more available in different areas at different seasons, and as the immediate locality of a group that stayed put was likely to become cleaned out of edibles if they kept harvesting the same spots over and over.

Why did we want to be able to stay in one place? Possibly because, when travelling, people could only take what they (and maybe the dogs) could carry. Everything that couldn’t just be picked up anywhere along the route, and/or readily found at the expected new location, needed to be carried: tools; tool-making tools; clothes; firepots; babies – how many babies and toddlers can one family group carry? Some of the adults need to have hands free, and bodies not overburdened, in case defense is suddenly needed against predators. And what about Brother, who took that bad leg injury? He survived it; but he can barely walk, only hobble a few steps. He’s the group’s best knapper – plus which, he’s your brother, and you love him. And there’s Grandma, whose balance has become terrible, and she’s nearly blind, she probably won’t survive the trip – but she still remembers teaching stories that nobody else has memorized yet; she’s teaching them to younger people, but that takes time, and the group is getting hungry now. Plus which, she’s your grandma, and you love her.

It’s been suggested that the issue was being able to keep property. But I suspect it was at least as much a matter of not wanting to have to leave people behind to die.

That population surge on becoming agricultural? Maybe it wasn’t availability of more (if less otherwise nutritious) calories. Maybe it was a matter of not having to kill or abandon babies because there were too many to be carried.

In the Sapiens, the postulate is that humans were trained by plants. You collect a whole bunch of grain, or beans, or whatever. you accidentally drop a few during harvest, or on the trail back to camp. Next year, there’s even more of the stuff, growing all along the trail. The trait that’s ready to be picked at the time you are back for your yearly campout is the one that gets picked and dropped more. You stay there longer as there is so much more. Pretty soon harvest time is a fairly long seasonal campsite. And with such a bounty, you stay longer before finishing it and moving on - plus, you can make these fancy clay rat-proof pots to store the food until it runs out. …and you figure out that seeds grow better and don’t get eaten by birds and mice if they are buried a few inches instead of scattered… Pretty soon you’re busting your behind to plant these seeds and water them and collect them and haven’t moved much. It’s a trap that sneaks up on the unwary nomad.

One postulate, too is climate - the end of the ice age brought enough stability to climate that this process could play out in the same locale reliably and long enough to trap humans. By the time they realized they were not living as well, there were too many, local game had been decimated, they were too busy building walls and stockades to defend their village, etc.

Jared Diamond in The World Until Yesterday describes the life of the 9agricultural) New Guinea nomads. they move from field to field as they have to - the women carry everything and the men walk beside them. Sexist? Not exactly - the tribal warfare is so fierce it is necessary for the men to always be armed on the move to defend the group from attack.

It’s quite possible that we accidentally domesticated grains. One major difference between domestic and wild grains is the ease with which they shatter – how easily the individual grain comes off the stalk. Domestic grains are resistant to shattering, which is bad for spreading their seed naturally but makes them much easier to harvest (corn/maize is an extreme example of this, and is so resistant to shattering that it can’t survive without humans to get the kernels off the cob.) Most wild grains shatter very easily; when they’re ripe enough to harvest, handling them enough to get the grain off means that a lot of the grain gets lost (from the human point of view) on the ground.

There’s going to be some variation in ease of shattering in a wild population. Humans gathering the seed are going to gather a higher percentage from the plants that shatter less easily; no intention is needed for this, it’s just the way harvesting wild grains work. Therefore, the seed that humans bring back to camp will be the seed from plants relatively resistant to shatter; and the seed that humans spill in camping areas will be from such plants. Rinse and repeat for a few grain generations, and the grain growing by human habitations will be shatter-resistant enough to notice.

Yes, indeed. Much as I love farming, it’s a trap. Once you’ve picked your farmland, you pretty much have to stay there. You’ve put that work into it, you want to get the harvest, but you’ve got to guard and care for the crop in the meantime, so you’ve got to stay put –

and then, while you were staying put, you had those extra kids –

and now you need more farmland; and there’s less and less area left in which you could make a decent living without farming, anyway, because farmers have taken it over.