Our teacher, the Beit Yosef, wrote in section 3: If one urinated, and diverted his mind from urinating, and afterward reconsidered and urinated another time – he must recite "Asher Yatzar" two times. Thus far his words, and his reasoning is: for he was already obligated by the first. And this is not similar to a meal where even if he diverted his mind from eating, and returned and ate, he only recites the blessing one time. For there it depends on his will, which is not the case with his bodily needs. And this is more similar to prayer, for if he forgot to pray – he prays the second prayer two times (Taz subsection 2). However, many and great authorities rejected this ruling from the halacha, and ruled that one should only recite the blessing one time, and such is the common custom (Bach, and Shelah, and Magen Avraham, and the Gra, and Sha'agat Aryeh). And more than this: that if he forgot to recite "Asher Yatzar" and remembered, and at that moment he felt a need for the orifices – he should not recite the blessing, but rather he should perform his needs and recite one blessing afterward for both of them (Sha'arei Teshuva). And one who takes a drug for a laxative and performed his needs, even though he knows that in some duration he will need his needs again, nevertheless he should recite the blessing each time. But if it appears to him that immediately and instantly he will need it – he should wait with the blessing until the completion of the cleansing. And this matter depends on the understanding of the heart (see Sha'arei Teshuva).
כתב רבינו הבית יוסף בסעיף ג: הטיל מים, והסיח דעתו מלהטיל מים, ואחר כך נמלך והטיל מים פעם אחרת – צריך לברך שתי פעמים "אשר יצר". עד כאן לשונו, וטעמו: שהרי כבר נתחייב בראשונה. ואין זה דומה לסעודה שאפילו הסיח דעתו מלאכול, וחזר ואכל, דאין מברך אלא פעם אחת. דהתם ברצונו תלוי, מה שאין כן בצרכיו. ויותר דומה זה לתפילה, שאם שכח מלהתפלל – מתפלל תפילה שניה שתי פעמים (ט"ז סעיף קטן ב). אבל רבים וגדולים דחו פסק זה מהלכה, ופסקו שאין לברך רק פעם אחת, וכן המנהג הפשוט (ב"ח, ושל"ה, ומגן אברהם, והגר"א, ושאגת אריה). ויותר מזה: דאם שכח מלברך "אשר יצר" ונזכר, ובעת מעשה נתאוה לו לנקבים – אין לו לברך, אלא יעשה צרכיו ויברך אחר כך ברכה אחת על שתיהן (שערי תשובה). ומי שנוטל סם לשלשול ועשה צרכיו, אף על פי שיודע שבאיזה משך יצטרך עוד לצרכיו, מכל מקום יברך בכל פעם. אך אם נראה לו שתיכף ומיד יצטרך – ימתין בהברכה עד גמר הנקיות. ודבר זה תלוי בהבנת הלב (עיין שערי תשובה).