Yes, a UTI can be passed on whilst having
sex.
...and the not so short (but still not too
long)

.
The most common cause of UTI's is a
bacteria known as 'e.coli' which can
survive even the harshest of conditions
(anti-biotics, a duration of boiling,
etc.) and it can be found pretty much
everywhere. So yes, you can get it whilst
having sex but it's far more likely that
you'd get it from a door handle, your
alarm clock, a newspaper...(I'm sure you
get it)...etc.