b) Second Law – Transferal of Deeds
This law is beyond the ability of the intellect and sense experience to discover, but can be clearly deduced from Qur’anic verses and narrations available to us. This law stresses that certain acts of obedience and certain sins are the cause of transmission of good or bad deeds from the one who has committed them to another, or the transferal of deeds from the other to the one who has committed them. Here are some examples from known sources:
1- Some sins committed by man in this world, like apostasy, nullify all of his good deeds, as in the verse:
وَمَن يَرْتَدِدْ مِنكُمْ عَن دِينِهِ فَيَمُتْ وَهُوَ كَافِرٌ فَأُولَـٰئِكَ حَبِطَتْ أَعْمَالُهُمْ فِي الدُّنْيَا وَالْآخِرَةِ ۖ وَأُولَـٰئِكَ أَصْحَابُ النَّارِ ۖ هُمْ فِيهَا خَالِدُونَ
‘And if any of you Turn back from their faith and die in unbelief, their works will bear no fruit in this life and in the Hereafter; they will be companions of the Fire and will abide therein’
Another is rejecting the message of the Quran and the insistence upon it:
إِنَّ الَّذِينَ يَكْفُرُونَ بِآيَاتِ اللَّـهِ وَيَقْتُلُونَ النَّبِيِّينَ بِغَيْرِ حَقٍّ وَيَقْتُلُونَ الَّذِينَ يَأْمُرُونَ بِالْقِسْطِ مِنَ النَّاسِ فَبَشِّرْهُم بِعَذَابٍ أَلِيمٍ
أُولَـٰئِكَ الَّذِينَ حَبِطَتْ أَعْمَالُهُمْ فِي الدُّنْيَا وَالْآخِرَةِ وَمَا لَهُم مِّن نَّاصِرِينَ
‘As to those who deny the Signs of Allah and in defiance of right, slay the prophets, and slay those who teach just dealing with mankind, announce to them a grievous penalty. They are those whose works will bear no fruit in this world and in the Hereafter nor will they have anyone to help.’
2- Some actions erase the bad deeds in this world and the next, like submission to God (turning to Islam), and sincere repentance:
قُلْ يَا عِبَادِيَ الَّذِينَ أَسْرَفُوا عَلَىٰ أَنفُسِهِمْ لَا تَقْنَطُوا مِن رَّحْمَةِ اللَّـهِ ۚ إِنَّ اللَّـهَ يَغْفِرُ الذُّنُوبَ جَمِيعًا ۚ إِنَّهُ هُوَ الْغَفُورُ الرَّحِيمُ
وَأَنِيبُوا إِلَىٰ رَبِّكُمْ وَأَسْلِمُوا لَهُ مِن قَبْلِ أَن يَأْتِيَكُمُ الْعَذَابُ ثُمَّ لَا تُنصَرُونَ
‘Say: "O my Servants who have transgressed against their souls! Despair not of the Mercy of Allah: for Allah forgives all sins: for He is Oft-Forgiving, Most Merciful. "Turn ye to our Lord (in repentance) and bow to His (Will), before the Penalty comes on you: after that ye shall not be helped.’ 
Summary so far:
Based on the what’s been presented thus far, we can conclude that the Hereafter is humanities goal and purpose, that Man falls short of knowledge related to the laws of that world, and therefore it is due to God’s wisdom and justice that He guides humanity to their intended happiness and righteousness through religion. Religion is a set of divine commands and prohibitions which are based on the real and practical needs of humanity.
So how does God convey those commands and laws to humanity? Two possibilities exist:
1) To convey the commands and prohibitions to each individual directly, in a sense that each human being establishes a direct link with the Almighty. But this is not possible, since this would not be in accordance with God’s wisdom of a perfect system.
2) To send Prophets and Messengers to convey His laws and to guide humanity to their intended happiness, through the shortest and most direct path.
Therefore it is imperative for prophethood to exist, since the source of legislation in the religion is God, and people would not be able understand the religion of God Almighty directly without an intermediary to explain the doctrines and laws, clarify any doubts and be the perfect example to his followers.
 39: 53-54