Halacha Yomi: May 2 2018

If one checked oneself before beginning Shmoneh Esrei or did not have the need to relieve themselves, and then feels the need to relieve themselves in middle, they should finish reciting the Shmonei Esrei and not interrupt (in a scenario that the pressure is not immediate, even if they cannot contain themselves for 72 min.). Afterwards, once one finishes the Shmoneh Esrei, one must relieve themselves before answering kedusha. One is permitted to leave the Shul in order to relieve themselves even if it means walking in front of someone saying Shmoneh Esrei.