That's what caused me to get stopped by the police my first day in Berlin a few years ago. I wanted to go to a board game store, so I looked one up on Google in the hotel lobby, walked to a u-bahn station, paid a couple euros for a ticket, walked downstairs and got on a train.
And promptly got pulled off the train at the next stop for not paying.
They were very understanding when I explained I had only been in the country about two hours (and showed my passport stamp as proof). They explained that there are machines to punch holes in the tickets... I did think it was strange that there weren't any turnstiles, but I figured, maybe you run into them on the way out or something (and I had only been in a foreign country two hours, everything was strange).