Aqa Ali Shah, His Highness Aga Khan II was born in 1246/1830 at Mahallat, where he spent the first decade of his age. In the outset of 1256/1840, Aqa Ali Shah had been taken to Iraq, where he stayed a few years with his mother. Under the instruction of Iranian and Arab teachers, eminent for their piety and learning, he had been taught the oriental languages, and he achieved a reputation as an authority on Persian and Arabic literature, as a student of metaphysics and as an exponent of religious philosophy. He mostly spent his time at Baghdad and Karbala in hunting expeditions with the Iranian princes, notably in compnay with Zill al-Sultan, the eldest son of Shah Fateh Ali, who ruled for forty days in Iran.
During the late 1256/1840, Aqa Ali Shah had been permitted by the Qajarid regime to take up temporary residence in Iran. His first marriage actualized with Marium Sultana in Iraq, which had been opposed by certain local ulema, but the Aga Khan's close friend, called Safi Ali Shah (d. 1316/1898) had made the marriage possible after winning the approval of the ulema. From Karbala they had gone to Baghdad where they had a friendly meeting with Major Henry Rawlinson (1810-1895), the then British political agent in Turkish Arabia. He decided to take the Aga Khan's family under his protection.
Aqa Ali Shah and his mother Sarv-i Jahan Khanum (d. 1299/1882) and his wife Marium Sultana, joined Hasan Ali Shah Aga Khan I in Bombay in 1268/1852. The old book of Bombay Jamatkhana records an entry that he attended the marriage of a certain Ismaili on June 17, 1852 at Bombay and was given a cash prize. Henceforward, Aqa Ali Shah regularly visited different Ismaili communities in Sind, Kutchh and Kathiawar, and lived for some time in Karachi. He had been appointed a member of the Commission in 1874 which was constituted to submit proposals for amendments of law relating to the Ismaili community.
On succeeding to the Imamate in 1298/1881, Aqa Ali Shah Aga Khan II maintained the friendly relation with the British India that had been cemented by his father. He was granted the title of His Highness by the British government, which was officially informed to him by the then governor of Bombay on August 9, 1882 on behalf of the Governor General.
The Qajarid king of Iran, Nasiruddin Shah (d. 1313/1896) had sent a message of condolence and sympathy to the Aga Khan II on the occasion of his father's death. Later on, a robe of honour and the emblem of Iranian crown studded with diamonds were sent by the king to the Aga Khan in Bombay as a sign of his relationsip with the Aga Khan's family.
He was appointed to the Bombay Imperial Legislative Council from 1880 to 1885, when Sir James Fergusson (1808-1886) was the governor of Bombay. According to Naoroji M. Dumasia in "The Aga Khan and his Ancestors" (Bombay, 1939, p. 61), "The nomination to the Council in those days was a rare distinction bestowed only on men of outstanding ability and high social position." He discharged his responsibilities and onerous duties in a manner which drew admiration of all. He was also the President of Mohammadan National Association at Bombay, and an honorary patron of the Western India Turf Club.
During Lord Ripon's regime a peculiar case arose in 1882, when Sir Courtney Ilbert framed and introduced a Bill, known as Ilber Bill. It intended to invest district magistrates and sessions judges with a limited jurisdiction to try European British subjects, and to empower local government to extend the powers to other officials of certain specified classes. The Ilbert Bill was opposed by the Indians, and a public meeting was held on August 27, 1883, with the participation of the Aga Khan II and other eminent persons. In the history of the nation-building of India, this meeting on the Ilbert Bill was justly regarded as most important, and indeed an epoch making event. In its resolution, a body of distinguished citizens was made in a deputation to Sir C. Baring to present the public opinions. This deputation included the Aga Khan II, Badruddin Tyab Ali (1844-1906), Feroz Shah, Telang, Mandlik, Sir Mangaldas Nathubhai and Premchand Roychand. The storm round the Bill however continued, and at length, the Bill had been amended and was passed on January 25, 1884.
He was also well concerned about the welfare of the Ismailis in India, and assisted the needy followers in Sind, Kutchh and Kathiawar. Recalling the events of his childhood, his son and successor the Aga Khan III once said: "My first recollection is of camping in tents and of travelling with my father. We went through Kutchh, Kathiawar and Sind, and I can never forget the memories of those days when we had to halt every two or three hours in order not to tire the horses and mules and donkeys and camels that carried our luggage. Now, looking back, it seems to me that we led the life of gipsies; we were almost a gipsy family. We carried our food about, as very often we could not get it at the places through which we passed. Even water for drinking was brought, sometimes from Bombay or Karachi, in the form of soda water."