Taboos and shunning are used to maintain social cohesion and group identity, protect the tribe from outside disturbance, promote conformity and cooperation and solve conflicts.
Punishment such as shunning is a form of reaction to harm. Other forms would be making amends or reprimands. Punishment can take the form of humiliation, retribution, pain, payment, labour, incapacitation or death.
In the case of hunter-gatherer tribes, most people would have basic survival skills and there would be unpopulated lands outside of the tribe land. That would make ostracism a better alternative to imprisonment or death.
The Nora in Horizon Zero Dawn has sentence set to a specific amount of time, up to 10 years for crimes such as murder. The outcasts are supposed to take care of themself, with no help from the tribe or other outcasts. The tribe will ignore them. At the end of their sentence they will be allowed back.