Longest martial law in Pakistan was imposed by General Muhammad Zia ul Haq
General Muhammad Zia ul Haq, who was the Sixth president of Pakistan, is considered as the only martial law administrator who ruled the country for nearly a decade. Zia ul Haq imposed martial law in 1977 and served as the head of state from 1978 till his death in 1988.
General Zia ul haq was killed in 1988 in a plane crash. He is considered as the longest serving de facto head of state of Pakistan.
Source: From books about History of Pakistan