وَاسْأَلِ الْقَرْيَةَ الَّتِي كُنَّا فِيهَا
Ask the town in which we stayed.
“Isʾal” is an imperative, “al-qaryah” is its accusative object, and “allatī kunnā fīhā” identifies the town. The grammar literally directs a question to a place, but a place does not answer questions in ordinary usage.
The intended referent is the people living there. Naming a place while meaning its occupants is a standard case of metonymy through locality (maḥalliyyah).