Maybe they hid some trackers on them.
All they had to do was add some kind of radioactive isotope to their food for the week prior to being released. Then they could track them once they return to Hamas