You can do this by using proper abstraction when you code your game.
For example, put your code the for the [ESC] key in a separate function, then, call that function from both the [ESC] key press and from the Android back button. You might need a native extension for the Android back button though, not sure if that is build in.