Praise be to Allah.
What this expression means if that if a person knew what was going to happen to him, which is a matter of the unseen, he would have been able to avoid the problems and evil that have befallen him. This is in accordance with the Muslim’s belief (‘aqeedah), and there is nothing wrong with it, because the unknown is something that is known only to Allaah. If it were the case that people could see the unseen and know of events before they happen, they would have achieved everything good and avoided everything bad. They would look at the causes of good health, wealth and happiness and they would pursue them, and they would look at the causes of poverty, disease and death and they would avoid them. But this is something hypothetical and impossible. The point is that man is incapable and weak and must submit to the fate that Allaah, may He be glorified and exalted, has decreed for him.
Allaah says (interpretation of the meaning):
“Say (O Muhammad صلى الله عليه وسلم): ‘I possess no power over benefit or hurt to myself except as Allaah wills. If I had the knowledge of the Ghayb (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’”
It says in Tafseer al-Qur’aan il-‘Azeem (3/524):
The best comment concerning this is what was narrated by al-Dahhaak from Ibn ‘Abbaas: “If I had knowledge of the unseen I would have acquired a lot of good” i.e., wealth. According to another report: “If I knew the unseen I would have known what would make a profit and what would not, and I would have made a lot of money and poverty would not have come my way.”
Ibn Jareer said: Others said: What that means is: If I had knowledge of the unseen I would have prepared for the year of drought (by setting side something) from the year of plenty, and I would have known when prices were about to go up or down, so I would have saved for myself from the times when prices were low for the times when prices were high.
‘Abd al-Rahmaan ibn Zayd ibn Aslam said: “and no evil should have touched me” I would have avoided evil before it happened. End quote.
Shaykh al-Sa’di said in Tafseer al-Kareem al-Rahmaan (p. 311): “If I had the knowledge of the Ghayb (Unseen), I should have secured for myself an abundance of wealth, and no evil should have touched me” means: I would have done the things that I know would have resulted in good and benefits for me, and I would have avoided everything that could lead to evil and negative consequences, because I would have known about things before they happened, and I would have known what they would lead to.
But – because of my lack of such knowledge – bad things may happen to me, and I may miss out on good things. This is the clearest evidence that I have no knowledge of the unseen. End quote.
See also the answer to question no. 49004.
And Allaah knows best.