The pain that you describe can be either due to muscle pull or due to colitis or kidney stone. In the latter two conditions, you may have been prescribed antibiotics. Since you got the pain while either passing urine or stool or just after it, these two conditions need to be looked into. While not really an emergency, you need to see a doctor as soon as you can. Take care!
The medical advice given should not be considered a substitute for medical care provided by a doctor who can examine you. The advice may not be completely correct for you as the doctor cannot examine you and does not know your complete medical history. Hence this reply to your post should only be considered as a guiding line and you must consult your doctor at the earliest for your medical problem.