Sharbat Gula had served a 15-day prison sentence in hospital where she was treated for hepatitis C.
She and her four children were handed over at the border. She is expected to meet President Ashraf Ghani in Kabul.
Gula, whose is remembered for her haunting green eyes, fled Soviet-occupied Afghanistan as a child.
She and millions of other Afghans sought refuge in neighbouring Pakistan and Iran.
After her arrest in Peshawar, near the border, on 23 October she pleaded guilty to all charges and was fined 110,000 rupees ($1,100).