I go to a foreign-language school.

Its a school teaching a foreign language.

Is there a hyphen there?

Thank you.
In simple terms, no hyphen is required in your second example because no ambiguity arises as to the intended meaning without one. We understand that the school teaches a foreign language. Phrases like this comprising a head noun ("language") and an attributive modifier ("foreign") are called 'composite nominals'.

In your first example the meaning of "foreign-language" that is ascribed to the school is similar (though it's implied that more than one language is taught), but "foreign-language" is modifying "school" and a hyphen is essential. Removing it would convey the quite different meaning that it was a school located in a foreign country that taught languages. "Foreign-language" is called a 'compound noun'.

Thank you!