I have 2 different TFS repositories (one is TFS 2012, another is TFS 2017).
What I need is:
1) Work in single workspace on my local machine, change code, do changesets...
2) All the changes should go to both repositories (they should be identical, but located in different places)
Is it possible at all?
No, that's not possible; what you're describing is not a common or supported scenario.