Some Muslims scholars from denominations other than Shiism believed that when the Prophet did not receive revelations in regard to a certain issue, he would improvise in that regard. On this basis, it is possible that the prophet sometimes made decisions that were not in the best interest of the Muslims. From this viewpoint, the verses pertaining to the battles of Badr and Tabuk are actually rebuking the prophet because he did not make the best decision.
Another group of scholars, however, believe that tark al-awla does not contradict the infallibility of prophets. But at the same time they have a different interpretation and understanding of the abovementioned verses:
In verse 67 of surah Anfaal (A prophet may not take captives until he has thoroughly decimated [the enemy] in the land.), it is not the prophet that is being scolded or rebuked, instead it is the participants in the battle that are being rebuked.
Also verse 43 of surah Tawbah which states: “May Allah excuse you! Why did you grant them leave [to stay behind]…” does not mean that the Prophets granting permission is either a sin in the eyes of God or an example of the literal meaning of the word “Dhanb” (an act that has ramifications). There is no rebuke in the verse, in fact it is praising and honoring the Prophet.
Therefore, no tark al-awla has been committed by the Prophet.
Many good discussions and researches have been done in regard to whether or not the prophets’ infallibility would stop them from committing tark al-awla (neglecting to make the better decision).
It has been said that the most that can be proven is their immunity towards sinning, making mistakes and forgetting things which does not encompass tark al-awla. Also, it is possible for God to punish his prophets because of making a good decision instead of the better one. This is not the severe punishment one receives for committing a sin, because in any event, the prophet has made a good decision not a bad one. 
Another group say: If revelations were not given to the prophet in regard to a certain issue, and he did not make the best decision himself, then revelations were sent down to advise him towards the best decision. An example would be the prophet’s decision pertaining to the captives of the battle of “Badr”  or the permission he granted to the hypocrites in the battle of “Tabuk”  to stay behind. 
However, the majority of Shia scholars, regardless of whether or not they believe tark al-awla contradicts infallibility, do not consider these verses referring to tark al-awla. For example, regarding the verses of the battle of Badr, they explain that it is not the prophet that is being rebuked in them.
In his tafsir of al-Mizan, Allamah Tabatabei writes: “The meaning of this verse is that it is not God’s precedent for a prophet to take captives and make money from this way unless his religion has spread throughout the world.
All commentators agree that these verses were revealed after the battle of Badr and that they are rebuking those who participated in the battle, finally allowing them to take money in return of freeing the captives.  Although some have said that if the verse is scolding them for taking fidyah (ransom) or taking ghanimah (spoils of war) before God allowed them to do so, then the rebuke would cover the prophet as well, because he consulted the people about fidyah before God allowed him to do so. But this interpretation is not correct, because the Muslims took fidyah after these verses were revealed. Also, the prophet’s status is loftier and higher than to possibly think that God would threaten him with a great punishment, because on one hand God does not punish anyone without a sin and on the other, He Himself has granted the Prophet infallibility.” 
As far as the permission granted by the Prophet in the battle of Tabuk, a group of scholars such as Fakhr Razi have said that the forgiveness in the verse is referring to tark al-awla which is not considered a sin and does not entail any punishment.
Others have said that the forgiveness is referring to making a good decision instead of the better one. This act can be a “dhanb” if the literal meaning of the word is intended, but not a “dhanb” when the Islamic meaning (a sin that entails punishment) is intended. This group says that the prophet granted permission out of improvising, because he had not received specific guidelines from God in this regard, and it is fine for a prophet to make such a mistake. What is not acceptable even by this group of scholars is for a prophet to oppose God’s command, for there is consensus that all prophets are infallible and would never lie or oppose God’s order in practice.
After mentioning these opinions, Allamah Tabatabaei says: “The verse is referring to the fact that the hypocrisy of those who did not participate in the battle is evident and that they are easily recognized through the smallest tests and trials. Therefore, it is natural for the verse to address the prophet with scold and rebuke, as if what he has done has covered up for their hypocrisy. This is one of the literary methods of mentioning a meaning in which the only purpose is to show how clear and evident the issue is. We use this method in our daily conversations when we supposedly address someone, but truly intend the message for someone else.
Similarly, the meaning of the verse is not placing any blame on the prophet, and then informing him that God has forgiven him (for he would never oppose the command of God.), rather it is solely indicating how obvious and clear the hypocrites’ lies are.
When God says: “Why did you give them permission?” He means that if you had not granted them permission their hypocrisy would have become evident for everyone, as they deserved to lose their credibility amongst the Muslims, but this does not mean that the loss of their credibility would be better for the religion and in the best interest of Muslims. 
Therefore, for the Prophet to grant permission is neither a literal “dhanb” nor a “dhanb” from the Islamic point of view. Also, the rebuke and scold in this verse is not truly intended, as the phrase “عفا الله عنک” is a prayer for the prophet, not an informative phrase that Allah has forgiven a past sin of his. 
For more information and further research, refer to:
1- Ta’ammulat dar Ilme Usule Fiqh, a series of kharij usul lessons by Ayatullah Mahdi Hadavi, first book, fifth chapter, the basis of the issuance of tradition, pp. 31-33.
2- Index: Verses on infallibility and the infallibility of the prophets in the Quran, Question 129 (website: 1069).
 Hadavi Tehrani, Mahdi, Ta’ammulat dar Ilme Usule Fiqh, a series of kharij usul lessons by Ayatullah Mahdi Hadavi, first book, fifth chapter, the basis of the issuance of tradition, pp. 21 and 22.
 The Quran says in regard to the captives of the battle of Badr: “ ما کان لنبی ان یکون له اسری ” which means “A prophet may not take captives until he has thoroughly decimated [the enemy] in the land.” (Anfal: 67)
 A group of the hypocrites came to the Prophet mentioning excuses and swearing and asked for permission not to participate in this battle. The Prophet granted them permission to stay behind.
“ عفا الله عنک لم اذنت لهم ” “May Allah excuse you! Why did you grant them leave [to stay behind]…” Knowing that the question in the verse is intended to scold and rebuke, the meaning would be: they deserved to never be granted permission to stay behind, Tobeh 43.
 Abd al-Ghani Khatib, Quran va Ilme Emruz, pg. 64.
 Meaning that God rebuked the Muslims that participated in the battle of Badr, because they took captives from the non-Muslims and then asked the Prophet not to kill them and get money in return of freeing them so that their financial status would be enhanced. Even though God severely rebuked them, he accepted their request and allowed them to use the ghanimah which also covers the blood money they would receive in return of freeing the captives.
 Tabatabai, Muhammad Husein, Al-Mizan (farsi translation), vol. 9, pp. 177-180.
 The reason for this meaning is the fourth verse mentioned after this one which states: “لو خرجوا فیکم ما زادوکم الا خبالا و لاوضعوا خلالکم یبغونکم الفتنة و فیکم سماعون لهم” because it is understood from this verse that for the prophet not to permit them was not in the Muslim’s best interest, but rather for him to permit them was in their best interest, because if he had not done so and had took the hypocrites with him, they would cause “khibal” (corrupt thoughts and intentions) for the other Muslims and would create division amongst them. Therefore, it was better that they be granted permission to stay behind.” [translation of al-Mizan]
 For further information, refer to: Tabatabai, Muhammad Husein, Al-Mizan (Farsi translation), vol. 9, pp. 381-388.