Yes, that can happen: Sometimes hackers get access to users devices through public wi-fi.
This is what happened with someone in Starbucks in Buenos Aires, if you follow news. Hackers target public places in order to infect many individual devices at once with mining software.
Actually, attempts to hijack public wi-fi are bound to increse in the near future. For hackers, this makes more sense, given that attacking a single personal device isnt worth it. Using one laptop you can mine about $0,02=0,05 worth of cryptocurrency in one day. But if you mine cryptocurrency off 100150 devices, that will give you $28. So, if you infect a few hundred routers with the mining malware, that could potentially bring you substantial returns.