Basically this scholar in Qom did not know the future. However, by looking at the Qur’an and examining its verse, he would be inspired to know what the intention of the person is. For example, he’d say to him: your intention is to get married and this girl is good for you (and it would turn out to be accurate and true). This is not fortune telling. This is being inspired by the holy Qur’an due to his piety.