Yes, it would work on wifi. He can't send traditional text messages but would be able to send iMessages or text through any text messaging app, like WhatsApp, as long as he had wifi. He would not be able to make a phone call without AT&T service. He could always facetime someone though.
As an aside, I'm a prosecutor and I have many, many defendants who do not have "working" cell phones but do use text messaging apps on wifi, particularly when making deals. Not trying to say that's what's happening here, and I certainly hope it isn't, but I do see it a lot.