Answer
Al-Biruni spent most of his life in Ghazni, which was the capital of the Ghaznavid Empire. He was born in 973 in Khwarazm, which was then part of the Samanid Empire. In 1017, the Ghaznavids conquered Khwarazm, and Al-Biruni moved to Ghazni. He remained there for the rest of his life, and he died in 1048.