US President Donald Trump says he has been speaking with Mexico about a potential military intervention.