In Genesis 4:3,4, we learn that Cain was a farmer and that Abel was a shepherd or herdsman. Both desired to show their reverence for God by offering Him the fruits of their labor. Genesis 4:4,5 also states that God had respect for Abel's but not Cain's offering.
At first glance, one might surmise that Abel was naturally favored by God over Cain. However, personality, appearance, etc. did not enter into God's response to the two sacrifices. It was the type of the sacrifice(s) that led to the rejection of one and the acceptance of the other.
Man was fallen from his original relationship, established in the Garden of Eden, with God because of sin. Adam originally was created perfect and without sin. Through the acceptance of Abel's sacrifice, God illustrates for us that there must be a shedding of blood for the forgiveness of sin. Abel's sacrifice involved the shedding of blood by the offering of the "firstlings of his flock," Genesis 4:4. Cain's did not. Hebrews 9:22 affirms this, "And almost all things are by the law purged with blood; and without shedding of blood is no remission."
Throughout the Old Testament the Jewish people offered animal sacrifices to God. One of many scriptures mentioning these sacrifices is Genesis 12:5, "Your lamb shall be without blemish, a male of the first year: ye shall take it out from the sheep, or from the goats." Note that the animal was to be "without blemish." In order for the sacrifice to be acceptable to God, it had to be perfect.
Why was God so exacting in his requirements for an acceptable sacrifice? God was giving us, in this illustration, a glimpse of his glorious plan of redemption for mankind from sin. God's justice demanded a corresponding price for the forgiveness of Adam's original transgression, a perfect man's life (Jesus) for a perfect man's life (Adam). Jesus' death at Calvary fulfilled God's design. Jesus was the only perfect being to inhabit the earth after Adam's fall. Jesus was without blemish, the only acceptable sacrifice for the remission of sin. The only one able to bring man back into harmony with his creator. 1 Peter 1:18,19 verifies this, "Forasmuch as ye know that ye were not redeemed with corruptible things, as silver and gold, from your vain conversation received by tradition from your fathers; But with the precious blood of Christ, as of a lamb without blemish and without spot."
Through Jesus' sacrifice, all of mankind will eventually be brought back into relationship with God and as Revelation 21:4 reads, "And God shall wipe away all tears from their eyes; and there shall be no more death, neither sorrow, nor crying, neither shall there be any more pain: for the former things are passed away."