According to Theological Wordbook of the Old Testament (TWOT):
The root occurs about 580 times in the Old Testament and is thus its principle word for sin. The basic meaning of the root is to miss a mark or a way. It is used two or three times in Ugaritic to mean “sin.”
The verbal forms occur in enough secular contexts to provide a basic picture of the word’s meaning. In Jud 20:16 the left-handed slingers of Benjamin are said to have the skill to throw stones at targets and “not miss.” In a different context, Prov 19:2 speaks of a man in a hurry who “misses his way” (RSV, NEB, KJV has “sinneth”). A similar idea of not finding a goal appears in Prov 8:36; the concept of failure is implied.
The verb has the connotation of breach of civil law, i.e. failure to live up to expectations, in Gen 40:1.
I guess the feeling in antiquity was that if a god expressed his or her preferences for his/her own worship, or his/her expectations for his faithful followers, and you missed the mark, you deserved punishment.