Ali Haider Gilani, abducted in 2013, was recovered in a joint operation by Afghan and US forces, foreign ministry says.