A security guard caught secretly filming women using the toilet in the Pilbara has been jailed for two and a half years.