"They drove all night until they found a motel that they could stay at" (the second one) sounds more natural to me. Small disclaimer: certain pedantic folks would argue that this isn't technically correct since you're not supposed to end sentences with a preposition, but you hear this sort of thing in colloquial speech all the time.
You could also say "They drove all night until they found a motel where they could say," but then I would omit the "at".