During the Second World War (1939-1945), when his father, Prince Aly Salomone Khan had offered his services to the Allies, the Aga Khan IV with his brother Prince Amyn Muhammad, accompanied by his mother, Princess Joan Aly Khan, had gone to Beirut, and thence to Nairobi on May 27, 1941 via Cairo, where they lived for four years. By the time, the Aga Khan IV was seven years old, he had been well versed in religious education under the tutorship of Missionary Kaderali B. Patel. In 1943, the Aga Khan IV led the Eid al-Fitr prayer amidst a large congregation of the Ismailis in the Jamatkhana, situated at Government Road in Nairobi. On that occasion, his mother remarked: "A great accomplishment for such a small boy." In 1944, he also visited Dar-es-Salam with his mother and brother.
At the end of the World War, the Aga Khan IV went back to Europe on May, 1945, where he joined the Le Rosey School, situated in Rolle, Switzerland. His classmates included numerous Europeans, including the Duke of Kent, the future king Baudoin of Belgium, the Prince Victor Emanuel of Italy, etc. Besides the prescribed education, the Aga Khan IV was taught Arabic, Urdu and Islamic History at home by Mustapha Kamal of Aligarh University. At the end of seventeen years, the Aga Khan's school days came to an end and proceeded to United States, where he enrolled as an undergraduate at Harvard University in Cambridge, Massachussetts, where he studied with great interest. His style of living at Harvard was quite frugal. His one roomate was highly amazed to discover that he had only two suits and one pair of shoes in his closet. He even did not own a car.
Richard T. Gill, the Allston Burr Senior Tutor of Leverett House at Harvard University gives his views in these words:- "His Highness was a good student at Harvard and a young man of exceptionally fine personal qualities. He took his studies seriously and yet found time for many extra- curricular activities, including the Islamic Association, the French Club and a variety of sports such as crew, hockey, soccer and skiing. These activities were vigorously pursued but they were not allowed to interfere with the fundamental, academic objectives of the college. In his last term at Harvard, His Highness's record won him the academic distinction of Dean's List standing. The general impression His Highness made on both Faculty and students here was an excellent one. He was completely at home with students of every background and did not in any way set himself apart from the general life of the college. He impressed those who knew him as a young man of great sensitivity and understanding who possessed both the mental and moral stature for leadership. His basic outlook was serious but he was at the same time a relaxed, pleasant companion with an amiable sense of humour. He was in the deepest sense, an outstanding citizen of the Harvard community." (cf, "Fatimi Sitaro" by Kadarali B. Patel, Bombay, 1958, pp. 13-4)
Initially, the Aga Khan IV studied mathematics, chemistry and general science. Soon afterwards, he started study of Islamic history and had an occasion to mix with the eminent professors, like H.A.R. Gibb, Philip K. Hitti etc. Besides his paper on "Islamic Sects and Mysticism", his paper, "Rise of the Nizaris and the Beginning of Dawa in Indo-Pakistan" was highly appreciated by his professors. He however could not finish his another paper on "Free Will and Predestination in Islam" when he had to leave the University. During his stay at Harvard, he was also a member of the Hasty Pudding Club and the Islamic Association.
In 1954, the Aga Khan IV, under the instructions of his grandfather, paid a short visit to the Indo-Pakistan subcontinent and East African countries with his brother. During the death of the Aga Khan III on July 11, 1957, his family members were in Geneva. Otto Giesen, a solicitor with the firm of Slaughter and May, brought the Will of the Aga Khan III to Geneva from Lloyds Bank, London, and read it at Barkat Villa before the Imam's family that:- "Ever since the time of my ancestor Ali, the first Imam, that is to say over a period of thirteen hundred years, it has always been the tradition of our family that each Imam chooses his successor at his absolute and unfettered discretion from amongst any of his descendants, whether they be sons or remote male issue and in these circumstances and in view of the fundamentally altered conditions in the world in very recent years due to the great changes which have taken place including the discoveries of atomic science, I am convinced that it is in the best interest of the Shia Muslim Ismailia Community that I should be succeeded by a young man who has been brought up and developed during recent years and in the midst of the new age and who brings a new outlook on life to his office as Imam. For these reasons, I appoint my grandson Karim, the son of my own son, Aly Salomone Khan to succeed to the title of Aga Khan and to the Imam and Pir of all Shia Ismailian followers."
Raymond Brandy Williams writes in "Religions of Immigrants from India and Pakistan" (New York, 1988, p. 190) that, "The Nizaris are the only Ismailis who claim an Imam for this time in a line that is traced to Ali: Prince Karim Shah, Aga Khan IV, is followed as the forty-ninth Imam with the designation (nass) traced back to Muhammad."
Upon his accession to the Imamate in 1957 at the age of twenty, he interrupted his undergraduate studies at Harvard for a year to visit to the various Ismaili communities, during which time he was installed to the Imamate in a number of enthronment ceremonies held in Dar-es-Salaam, Nairobi, Kampala, Karachi and Bombay. Having toured for 18 months, the Aga Khan IV returned to Harvard, where he worked twice as hard, studying as well as guiding the community. He took eight courses instead of four and wrote thesis on relation between Druze and Maronites in Lebanon from 1829 to 1835. He was awarded the degree of M.A. on July 11, 1959 at Harvard, and thus, he remained about 23 months as a student of Harvard University during his Imamate period. He also granted 50,000 dollars worth scholarships for students from the Middle East, Africa, Pakistan, India, Iran and Afghanistan. Already, a large sum had been donated to introduce the Aga Khan Chair of Islamic Studies at the Harvard and Beirut Universities.