A quick survey of the Internet reveals the answer is "maybe?"
Here's what there is universal agreement on:1) An employer is allowed to ask whether someone meets legal age requirements for a job (such as: Are you over 18?)2) Beyond those specific legal requirements, an employer cannot use age as a factor when determining who should be hired for a position.
So that's why it's a maybe. If they were asking for legal reasons, then it probably was legal to ask, although the question was just poorly worded. Otherwise, there's a much bigger gray area.
I should note that I'm not a lawyer and I don't work in HR for these kinds of things, so clearly my answer isn't legal advice of any kind. But my guess was the question was supposed to be innocuous.