This saying is not a hadeeth from the Prophet (blessings and peace of Allah be upon him) and it is not narrated from any of his Companions; rather we do not know of anyone who is an authority in Islamic knowledge who said it or approved of its meaning.
Moreover, this saying is not correct in and of itself; rather it is false and is contrary to what Allah has instilled in His slaves of keenness to seek good and ward off harm. If it so happens that a person travels and an accident befalls him or his family or his wealth, it would not be said that if he had known the unseen before he travelled and that an accident would befall him, that with that prior knowledge he would still have travelled. No one would say such a thing and no wise person would do that at all.
Rather the meaning that is intended by this phrase is that the alternative to this accident that befell him would have been more harmful and worse. If he had not travelled, then he would have died, for example, or he would have met with an accident that was worse than the one that did befall him. Because of that people say: you would have been content with what befell you because it was the lesser of two evils and the smaller of two losses.
Undoubtedly this is speculation based on false assumptions and speaking of Allah without knowledge. The notion that being saved from this calamity would inevitably mean that something worse would happen to him is in fact more akin to thinking negatively of Allah and His decree.
One of the things that indicate that this saying is false is the verse in which Allah, may He be exalted, says:
“Say (O Muhammad SAW): I possess no power of benefit or hurt to myself except as Allah wills. If I had the knowledge of the Ghaib (unseen), I should have secured for myself an abundance of wealth, and no evil should have touched me. I am but a warner, and a bringer of glad tidings unto people who believe.”
Abu Hayyaan (may Allah have mercy on him) said:
That is, my situation would have been different and I would have secured for myself an abundance of wealth and avoided evil and harm so that none of that would have touched me.
End quote from al-Bahr al-Muheet, 4/355
As-Sa‘di (may Allah have mercy on him) said:
That is, I would have done the things that I know would have served my interests and brought me benefits, and I would have avoided anything that could have led to bad outcomes and negative consequences, because I would have known about things before they happened and what their outcomes would have been.
But I – because of my lack of knowledge – have been affected by bad things and I have missed out on worldly interests and benefits; this is the clearest indication that I have no knowledge of the unseen.
End quote from Tafseer as-Sa‘di, 311
Ibn ‘Ashoor (may Allah have mercy on him) said:
The statement that he has no power to bring benefit for himself or ward off harm comes before the statement that he has no knowledge of the unseen, because the aim behind people’s desire to know the unseen is to try to hasten the future good by taking measures to guarantee it and bring it closer, and to avoid harm. So stating that he has no power to bring benefit for himself or ward off harm includes all kinds of power and all kinds of benefits and harm, and that includes whatever of that there may be in the future, which is part of the unseen.
End quote from at-Tahreer wa’t-Tanweer, 9/207-208
From all of the above it becomes clear that a person may miss out on some good or be affected by some bad and harm because of his ignorance of that which is hidden from him (the unseen), and that if he were to know of these unseen matters, he could have taken measures to protect himself from what already befell him of harm and he could have taken measures to attain what he already missed of good.
And Allah knows best.
Reproduced from Islam QA