The first sentence as it currently stands isn't quite right, but the second is fine. You can actually use either 'which' or 'that'. I would always use 'that' but I'm a native Brit and others may speak differently!
'This is the town that/which I visited first in the UK.'
It sounds a bit better if you switch the order and say:
'This is the first town that I visited in the UK'
or even more simply
'This is the first town I visited in the UK'
I hope that helps! :-)