Non citizen nor alien that worked in a foreign country most of 2016 but now i'm in the US as a resident, shall i pay taxes in the US for 3 months?

During 2016 i worked outside the US and paid taxes there, and during that time i wasn't a US citizen nor i have any type of US visa, i was just a foreign person. 

In October i came to the US with a greencard, so i'm a resident now. I got my W2 from my company, but i've worked in the US only for 3 months.

Do i have to pay taxes in the US too? I thought nobody can pay taxes in two different countries for the same year, what should i do?