The word in its current form is early 20th century, probably from New Orleans or a creole enclave in the Caribbean.
The origin is not clear, but personally I suspect it is from French putain ('prostitute'), which is itself from Old Italian/Vulgar Latin putta ('girl').
Also possible is via Limba puntuĊ ('vagina'). Limba was a West African dialect found in Sierra Leone.
Another option (which I don't support) is from Old French put ('stinking') via Latin putidus ('stinking').