Can vertex indices be transferred between identical meshes?
I may be missunderstanding what you are trying to do here, wouldn't just making a copy of the Green cube in object mode be the easiest way to insure that both objects have identical vertex indices?

I thought it would be possible to Transfer Mesh Data from Green to Red cube. Object menu > Relations > Transform Mesh Data but I couldn't get it to work.

Tried with the Data Transfer modifier but again with no success.

That left the long way of transferring vertex indices :
Link the data of the Red to the Green and then remove the link.



In Object mode first select Red object then select the Green one. Object menu > Make Links > Object Data.


The Red object now has the same vertex order as the Green object: 


......... but also using all other data from the Green object. 
The Red can be unlinked in the Object Data Properties menu:


There must be a more elegant way of doing this  :)

there you go ... an Addon, see comment above.  Thankyou  @R-800  :)