This question doesn’t have a brief answer. Please click on the detailed answer.
This problem occurs for many people. Fortunately, Islamic scholars have been able to find what the duty of such persons is from the hadiths of the Ahlul-Bayt. Imam Khomeini says: “If a person suffers from an incontinence, due to which drops of urine come out continuously, or he is not in a position to control his bowels, he should act as follows: “If he is sure that at some time from the beginning of the prayer time till the end [for instance, for the fajr prayer, it would be from dawn till sunrise], there will be a respite during which there will be a restraint, then he should perform wudhu and prayer at such time. If during the restraint, he can control his urine or excretion only enough to perform wajib acts of namaz, then he should perform only obligatory acts, and abandon the Mustahab acts (such as adhan, iqamah, qunut).”
“But if the respite doesn’t even suffice for performing wudhu and prayer and he has urine and feces excretion during the prayer, making wudhu once will be enough…”
Also, in order to prevent the spread of the nijasah, it has been said: “A person who cannot control urine, should use a bag filled with cotton or something similar that doesn’t allow urine to reach other places, and the obligatory precaution is that before every namaz, he should wash the outlet of urine which has become najis.”