Trump was addressing a crowd gathered for an event on federal judicial confirmations.
Those attending included longtime Texas Senator John Cornyn, a Republican, who is up for re-election in 2020.
Trump told Cronyn he "didn't have to worry about Beto anymore." O'Rourke nearly beat Republican incumbent Ted Cruz in a Texas senatorial race in 2018.
Some Texas Democrats are pushing O'Rourke to run against Cornyn, but O'Rourke, a former Congressman, has said he isn't interested.
O'Rourke recently ended his campaign in the 2020 presidential race.