All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
The person whose ablution is invalidated during the Ghusl by passing wind or any other invalidator of ablution is obliged to perform ablution afterwards when he wishes to perform the prayer as long as he does not suffer from incontinence. As for the one suffering from wind incontinence, if he performs Ghusl after the time of prayer has become due, then there is no harm on him due to the wind which he passed during Ghusl or after Ghusl, even if he passed it during the prayer, because his purification was established by performing Ghusl after the time of prayer became due. His burden is lightened by performing ablution for every prayer after its time has become due (only) to reduce hardship. For more benefit, please refer to fatwa 83492.
However, if he performs Ghusl before the time of the relevant prayer becomes due, then he is obliged to perform ablution after the time of prayer becomes due. The Prophet, sallallahu ‘alayhi wa sallam, said to the woman suffering from non-menstrual vaginal bleeding to perform ablution for each prayer. [Al-Bukhaari]
The researching scholars held that the ruling that applies to the woman suffering from non-menstrual vaginal bleeding applies to whoever suffers from a continuous invalidator of ablution (such as urinary or wind incontinence).
Hence, if you perform Ghusl after the time of prayer has become due, then you are not required to perform ablution afterwards because you have become ritually pure upon performing the Ghusl. If you perform Ghusl before the time of prayer becomes due, you have to perform ablution for the prayer after its time has become due.
Allah knows best.