Oh yes they can, that question has been settled in the aftermath of the Yugoslavian Wars [1, page 148]:
> 46. The law is thus clear: a hospital becomes a legitimate target when used for hostile or harmful acts unrelated to its humanitarian function, but the opposing party must give warning before it attacks
[1] https://www.icty.org/x/cases/galic/acjug/en/gal-acjud061130....