President Donald Trump on Thursday congratulated Democrat Nancy Pelosi on her election as House speaker and insisted on the need for a wall along the US-Mexico border.