A seriously ill girl ordered to leave the US has been given a year's reprieve after warnings she could die within days if her treatment was stopped.