Of course what constitutes unacceptable anti-social behaviour differs from one society to another. In some societies, both historically and even today, infanticide, abortion, euthanasia, ritual mutilation, child abuse, rape, theft, bribery, blackmail, assisting another's suicide, or the supplying of products known to be harmful, can all fall in the area of conduct accepted by the society as a whole - whether that is as a reflection of the behavioural norms or as ordered from above by rulers, judicial arbiters or religious leaders. Moreover standards of what are viewed as good and bad behavior are not constant over time: for example contemporary society's rapidly changing attitudes to homosexuality, to race, to religious blasphemy and apostacy, and to children born outside of marriage.
Take the deliberate vengeful killing of another person - murder.
In many 'tribal societies' for want of a better term, killing kin is often seen as completely unacceptable, but killing non-kin is not - or at least killing one's own kin is often deemed more acceptable when the victim has already alienated themself from society by their own anti-social behaviour. Thus societies have been able to accept and officially sanction ordinary folk to go just right ahead and, hors judice, kill rapists, thieves, arsonists, apostates, blasphemers, adulterers, homosexuals or witches (it ain't known as a witch-hunt for nuffin!). This is of course basically 'justice' by mob rule, but deplorable as it is, it's still far from uncommon. And of course even in modern nation states it is legal, often even encouraged, for ordinary members of society to go and kill humans outside of their own 'tribe', although generally only once formal war has been declared.
Similarly slave-owning societies typically viewed their slaves as not full members of society. A Roman slave for example was treated primarily as property and could be miss-treated and even killed simply on the owner's whim. To do so was generally frowned upon as both wasteful and indicative of poor character on the part of the slave-owner - much as one might view a millionaire burning £50 notes for a laugh - but there would be no legal repercussion. Indeed Roman writers such as Cato the Elder advised that you regularly beat or otherwise roughly treat your slaves, just to keep them in line, and in legal cases a slave's testimony was only acceptable in court if it had been obtained under torture. In many societies even one's own children were viewed as one's property, thus for example in Hammurabi's code and in the spirit of 'an eye for an eye', if you killed another citizen's son, even accidentally, the penalty was that your own son be put to death, regardless of how blameless your lad might be. (And remember that in English Common Law a man's wife and underage children were still defined as his property and unable to act independently in financial matters until the late 19th century). Societies have also often condoned, even required, murder for state or religious reasons, hence the ancient practice of human scapegoating in it's original sense; executions for cowardice in times of war, pour encourager les autres; or human sacrifice to keep the gods happy, the people in their place and society ticking along as normal.
Similarly regarding theft - taking things that you do not have a right to.
While stealing from your friends, family and immediate neighbours is generally frowned upon and not conducive to engendering mutual trust, plenty of societies view theft from those outside the clan - whether as horse-rustling, cattle-raiding, sheep-stealing, going a-viking, or just indulging in petty shop-lifting - as part of their culture. "Raids are our agriculture" goes an old Bedouin proverb* reflecting the nomad's view that humble farmers are almost sub-human rabble, whom the unconstrained nomad does not feel obliged to treat as equals and from whom he certainly has no qualms in taking anything that he wants (albeit also tacitly recognising that in some ways he is dependent on them: how else could he obtain the grain for his daily bread?). And what of 'protection' from the mafia: is that theft or just a coerced 'donation'? In short is the relationship parasitic or symbiotic and is 'being within the clan' always a good thing?
Officially-sanctioned theft from 'the other tribe' also has a long history in terms of privateers with their government letters of marque and of mercenary bands employed to wage war simply on the promise of booty. And what indeed of government sanctions of foreign individuals and, in time of strife, the seizing of their private property and assets? Meanwhile at a lesser level, while many people would baulk at stealing from their own friends, family or the corner shop, fiddling one's tax return or pocketing your employer's stationary is often seen as something other than theft at all, perhaps because it's largely victimless and, well, "everyone does it, don't they" ie it's accepted as a social norm.
So while the concept of laws and taboos against severely anti-social behaviour are probably mostly about retaining coherence of the group, it inevitably gets rather more complicated when the society one lives in starts to grow to be above just a dozen or so closely-related families.
* My quotation "raids are our agriculture" appears in Bruce Chatwin's final rambling pensées entitled 'Songlines' (published in 1988), although I have also, more recently, seen the same saying ascribed to the Mongols. I cannot currently find my copy of Chatwin's work and frankly I doubt he bothered to give a proper citation: that's just the way he was, particularly as knew he was shortly to die. Nevertheless I have no reason to doubt it's veracity and so you'll just have to take my re-quotation of a Bedouin/Mongol proverb at face value.