US President Barack Obama has arrived in Afghanistan on a previously unannounced visit. He and Afghan President Hamid Karzai signed a 10-year accord charting future relations between the countries.