Ali was in Pakistan to carry out social and research work at a cardiac hospital in Rabwah, which he helped build some time ago.
The attackers managed to flee after killing the doctor. No group claimed responsibility for the attack.
Ali was reportedly a dual national of Pakistan and the US.
Pakistan's Ahmadis consider themselves Muslim but were declared non-Muslims through a constitutional amendment in 1974. A decade later, they were barred from proselytising or identifying themselves as Muslims. Some 1.5 million Ahmadis live across the country.