Were the prophets, may Allaah exalt their mention, infallible?
All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
All the prophets, may Allaah exalt their mention, were saved from committing major sins and mistakes pertaining to the conveyance of the message of Allaah The Almighty. They did not conceal anything that Allaah The Almighty revealed to them nor add anything to it from their own accord. Some of them, however, may have committed minor sins. Thus, most of the scholars held that prophets were not infallible from committing minor mistakes, and that if they were to do any, it would be something negligible: Allaah The Almighty would notify them of their mistake so that they could immediately repent and stop. This ruling applies to matters of a religious nature. However, in worldly matters they might have committed mistakes despite their mature minds, sound opinions and deep insight.
In a Hadeeth on the authority of Raafi‘ ibn Khadeej the Prophet arrived in Madeenah and found its people pollinating palm-trees. He suggested that they should not do that, and they listened to him. As a result, the trees did not produce dates that year and they informed him of the [negative] result. The Prophet said that once he ordered something to be done that was connected to religion, we must do it; but if he ordered something that was purely related to worldly matters, he did so as a human who might be right or wrong. [Muslim]
In the battle of Badr, a similar incident took place with Al-Hubaab ibn Al-Munthir .
Allaah Knows best.
You can search for fatwa through many choices