Answer: Under the McKinney-Vento Act, the student has the right to attend the school of origin, or any public school that nonhomeless students who live in the attendance area where he is staying are eligible to attend. 42 USC 11432(g)(3)(A)-(B). The school of origin is the school attended when the child was permanently housed, or the school in which last enrolled. In this situation, it sounds like both the school attended when the child was permanently housed and the school in which last enrolled are in the second state, not your state. Considering the second state is far from your state, the school of origin would not be a viable option due to the distance.
Therefore, we are looking at the public school(s) that nonhomeless students who live in the attendance area where this student is staying are eligible to attend. If the student has not stayed in a motel or other homeless situation in the district where he attended prior to leaving the state, then he would not have the right to attend that district. The student should enroll in a school in the attendance area of the motel where he is currently staying. Should he move again, that school will be his school of origin, where he can remain for the duration of homelessness, and also until the end of the school year in which he becomes stably housed.