It is not the penetration that causes the UTI (urinary tract infection). It is mechanical friction against the short female urethra that allows bacteria to enter the bladder. This happens during intercourse and yes, urinating after intercourse will irrigate the urethra preventing a UTI.