I found an iphone a while ago and need advice?

I had found an iphone 2 years ago and tried to contact the owner multiple times via the emergency contact list and no one had answered or came looking, if I sell it is it a legal transaction?

Well, since you tried to contact the owners and they didn't bother trying to get their phone back, I'd say it's not illegal to sell it. Try contacting them through the emergency contact list a couple more times.