They issued their call in a statement released by the White House shortly after the two met in Washington DC.
It comes after attacks in recent years on Indian soil which Delhi claims were conducted by Pakistan-based militants.
The two also discussed improving trade links. It was the first time the two leaders had met face to face. The White House also said India “appreciated” the recent move by the US to label top Kashmiri militant Syed Salahuddin a “specially designated global terrorist”, which effectively blocks him from transactions in the US.
The joint statement said the leaders “called on Pakistan to ensure that its territory is not used to launch terrorist attacks on other countries”.
They also said they would strengthen cooperation against threats including Pakistan-based militant groups Jaish-e-Mohammad and Lashkar-e-Taiba. They urged Pakistan to “expeditiously bring to justice” those behind the 2008 Mumbai terror attacks and last year’s attack on an air base in Pathankot, which Indian officials have suggested were perpetrated by those two militant groups.
India has in the past accused Pakistan of conducting state-sponsored terrorism, which Pakistan has strongly denied.
Earlier on Tuesday, Mr Modi and Mr Trump gave a joint news conference in the White House’s Rose Garden.
“The relationship between India and the United States has never been stronger, never been better,” President Trump said.
He praised Indian airline SpiceJet’s recent order of 100 planes from US manufacturer Boeing, and said he looked forward to exporting more energy resources to India, including natural gas.
Mr Trump, who regularly posts on Twitter, also described himself and Mr Modi as “world leaders in social media”.Mr Modi said the US was India’s “primary partner” for its social and economic transformation, and that his plan for a “new India” converged with Mr Trump’s “vision for ‘making America great again’”.
He also said the fight to remove safe havens for terrorism was an important part of US-India co-operation.
Mr Modi invited President Trump and his family to visit India, which Mr Trump accepted, said the White House.
Mr Trump said his daughter, Ivanka, would also be leading a US delegation to an entrepreneurship summit in India later this year.
The two leaders later had dinner, marking the first time Mr Trump hosted a foreign dignitary at a White House dinner. Earlier in his trip to the US, Mr Modi met the heads of 20 US companies, including Apple’s Tim Cook and Google’s Sundar Pichai.
He told them that his government had pushed through thousands of reforms to make India “business friendly”.
He later tweeted: “Interacted with top CEOs. We held extensive discussions on opportunities in India.”
Although the US and India are both economic powerhouses, there are sharp differences on issues such as immigration and climate change.
In an article for the Wall Street Journal ahead of Monday’s meeting, Mr Modi said India and the US were “mutually reinforcing engines of growth and innovation”. (BBC)