This is an interesting question, one that had never occurred to me before because I always assumed he had been singing about Nellie Forbush. I've checked the original production script for the play (1949, as presented by the Library of America in 2014).
In Act 2, scene 4 of the original script, Nellie tells Emile that she can not be with him because he had children by a Polynesian woman. After Nellie departs, Emile asks Cable "What makes her talk like that?" and expresses his confusion about her racism. Cable answers by singing "You've got to be taught," and Emile immediately follows with the song you ask about, "This Nearly Was Mine." The timing suggests he is thinking about Nellie.
The lyrics of that song include "Close to my heart she came / Only to fly away," which one could interpret as a reference to the death of the Polynesian woman, but which seems to be a much more straightforward description of Nellie's departure. He continues "Now, now I'm alone," which again seems to refer to Nellie, because the other woman had been gone for a long time. The other lines in the song are ambiguous, describing a loving future that might have been.
Immediately after finishing the song, Emile agrees to join Cable in the seemingly suicidal mission to Marie Louise Island. He agrees, despite having refused earlier. The death of the Polynesian woman clearly did not inspire this change of heart, as it had happened years before. Nellie's flight, however, has left Emile with nothing to live for [except his children, but he overlooks them in his grief].
Further, Emile says repeatedly in the script that he loves Nellie (even singing "Some Enchanted Evening" about the moment he first saw her), while there is no evidence in the script that he ever loved the Polynesian mother of his children (in Act 1, scene 12, he says only that she was "beautiful" and "charming").
Put together, the evidence makes clear that the song is about Nellie, though Emile's sense of grief may be heightened by the fact that she is not the first woman he has lost.
Disclaimer: This aspect of the plot may be somewhat different in the movie, and there may be different information in the story collection "Tales of the South Pacific" on which the play was loosely based.