The trip to a remote mountain location in the north of the country came on the third day of the royal tour.
The duke and duchess were shown how the Chiatibo Glacier had retreated rapidly in recent years due to global warming.
Prince William said communities "vulnerable to change" needed more awareness of climate change.
The duke said young people were "starting to get engaged", adding that a "positive conversation" around the issue was needed.
The couple arrived by helicopter to the Hindu Kush mountain range in the Khyber-Pakhtunkhwa province.
On a visit to a flood-hit area in the Chitral region, they spoke with a young woman who was named after the duke's late mother, Diana, Princess of Wales - and has a son of her own called William.
Princess Diana was visiting the area around the time she was born in 1991, a translator later explained. The woman is now part of an emergency response team of volunteers funded by UK aid.
On their arrival Catherine was presented with a traditional Chitrali hat - almost identical to one William's mother received on her visit 28 years ago.
The duke was also presented with a book commemorating his mother's trip to the area.
Global warming has seen the Chiatibo Glacier in Broghil National Park retreat by some 10 metres a year due to higher temperatures melting the ice.
The first threat from the glacier melting is flooding to communities down stream, while the second is removing the water supply completely - which provides for 200 million people in Pakistan.
Glacier expert Dr Furrukh Bashir said he hoped the duke and duchess' visit would raise awareness of the issue.
Following their trip to the glacier, the couple remained in the region to meet with communities affected by global warming.
The couple visited Bumburet, which was destroyed by flooding in 2015.
They also watched an emergency response drill, which included demonstrations of how members of the community carry casualties over a river.
They later visited a settlement of the Kalash people, a non-Muslim minority population, where they watched a traditional dance.
In a speech on Tuesday evening, William urged the UK and Pakistan to "work together" amid an "impending global catastrophe" over climate change.
The duke and duchess also met schoolchildren and had lunch with Pakistan's prime minister and former cricket star Imran Khan, as part of their tour of the country.
The five-day trip was organised at the request of the Foreign and Commonwealth Office.
It’s always the ones with the dirty consultants that do the clean audits.