Ali al Hadi was born in Medina to Muhammad at Taqi and a Moroccan slave named Samana. He was only six when his father died, and when he had to take on the Imamate. Initially he lived in Medina in relative peace, where he mostly engaged in teaching. But upon the caliphate of Al-Mutawakkil, he was summoned to Baghdad and put under house arrest in Samarra, along with his son Hasan al-Askari. He was kept here to stop all communication between himself and his followers. His time in prison was a time of great persecution against the Shia.
He would live out his life under house arrest, and died at the age of 40 on July 1, 868. Like his predecessors, it may have been by poison. He was buried at his house in Samarra by his son, who was also the only person to attend his funeral. His burial spot is now an important Shia shrine.