Is it allowed to talk to your opponent in a tournament game? Suppose my opponent in a tournament was running very low on time, and after move 40, presses the clock and leaves the board for a while, falsely believing they will get extra time on their clock. There have been many losses on time as a result of a similar situation. In this case, is it allowed to warn your opponent of the potential danger of flagging?
In this case, is it allowed to warn your opponent of the potential
  danger of flagging?


Yes. The rule which limits talking to your opponent is the one which forbids annoying the opponent, article 11.5 -


  11.5 It is forbidden to distract or annoy the opponent in any manner whatsoever. This includes unreasonable claims, unreasonable offers of
  a draw or the introduction of a source of noise into the playing area.


If your opponent has left the board and you remind him of the time control this cannot be interpreted as distracting or annoying. It is helpful.