The first instance of Islam in the region we now know as Pakistan came during the reign of the third Caliph, Umar ibn al-Khattab in the year 660 CE. The Muslim armies from Medina fought local Makran tribesmen near modern-day Karachi on the banks of the Indus River.
The Muslim forces were victorious, but after hearing the region had little potable water and poor agriculture, Umar decided against expanding the Caliphate any further. He ordered his armies to remain on the western side of the Indus and let the Makrans have the eastern shores.
Fifty years later, the Umayyad Caliphs were ready to expand the borders of the empire. The other side of the Indus River, known as Sindh, was ruled by a Hindu king named Raja Dihr. The Umayyad governor of Basra, Hajjaj ibn Yusuf, sent his grandson, Muhammad ibn Qasim, with an army to conquer the remainder of Sindh.
Muhammad ibn Qasim defeated the Hindu king establishing Islamic rule in much of what is now considered modern-day Pakistan.