Is there a chemical that can be used to subdue ants only temporarily without permanent harm?
CO2 is often used for temporary knockouts of insects. I've used it myself for fruit flies (Drosophila melanogaster), and it's quite straightforward and very effective to hit them with it until they're asleep. However, this was in a rather expensive lab that had CO2 on tap - not a particularly accessible method to the average person.

What I'd recommend instead is to chill the ants. Simply capture them and put them in the fridge for a while. Read this wiki article and go to the part about "quiesence" for more. Quote: "quiescence acts like an anesthetic". It's short term, non-harmful and fully reversible. Also much more accessible to someone who isn't working in a big expensive lab. I assume that the ants will stay still long enough for your measurements - if not: put them back in the fridge for a bit. And better yet, there's no chemicals used, so no need to clean the ant and there's no cost to you.