To answer your direct question, yes the original warranty transfers over. HOWEVER, you have to be a bit concerned that the warranty could have been voided.
My first iPhone was a 3GS I got off eBay a year and a half ago. It seemed to be in decent condition at first. Only problem was the Home button was a bit unresponsive. Seemed okay initially, but then I had to press harder, then twice. Soon thereafter it stopped functioning at all. Took it to my Apple Store and the kindly Genius inspected it. He said one of the water damage indicators got tripped but not the other and speculated that it could have been water damaged with a replaced screen. He recommended that I complain on eBay, but right when I thought I was going home with a screwed iPhone, he said he'd replace it for me. So it worked out, and I don't want to scare you, but I do want to prepare you for the possibility that there could be a warranty issue since there potentially was with my original used iPhone.