I got a iPhone 6s from a friend yesterday and I happened to shut it off and I turn it back on?

It's telling me that the touch ID requires my passcode when iPhone restarts, I tried the code i set up but it's not working should my friends old password work to unlock the phone?

If you set up your own passcode, that's what it needs.

They need the code once every few days whether turned off or not, probably so you don't only ever use fingerprint and forget your code.

It _should_ have had a factory reset when you got it and been reactivated, to prove it has no data or linkage to the previous owner, then linked to your apple account. It you did that, any previous passcode would have been erased.