Far less powerful Divinations than commune can get this information, and creatures’ alignments seem like a thing that gods would usually know, unless a creature has gone to extreme lengths to hide it. Under the default alignment rules,
Yes, this is ok
The thing to remember is that, officially, a creature’s alignment is an objective and measurable fact of their existence. Also, remember that alignment should not be a straitjacket, and does not, by itself, tell you anything except for how their past actions, on average, can be characterized in a vrry general way. Therefore, keep in mind that
Past performance does not guarantee future results
A Lawful Good character can backstab you – particularly if he thinks it upholds a greater good or answers to a higher authority. Historically, his alignment indicates he usually hasn’t done that, but this could be an exception.
A Chaotic Evil character can totally uphold his end of a bargain in both the spirit and letter of the thing. He, again, wouldn’t usually, but it’s not very chaotic to always do the same thing.
But most of all, mechanical, objective alignment doesn’t lend itself well to any significant moral or ethical dilemmas. If you aren’t comfortable with it – and many people, myself included, are not – I strongly suggest houserules to massively, if not entirely, downplay both the objectivism and mechanical nature of alignment.
In my own games, I tell players that writing down an alignment is optional: it should be a shorthand for the deeper characterization to be found in their backstories and personalities, and I encourage my players to have characters that are too complicated to reduce to just a pair of trinary choices. After all, no one in real life can be.
So this might be a good time to take your players aside and say, “Look: no. I don’t want you using commune that way, because I don’t like such simplistic alignments. I want to discuss with you some ideas for replacing it with a more realistic approach to ethics and morality.”
This does mean figuring out what to do with detect good or Smite Evil, though. Replacing mechanical alignment is not trivial. That would be a separate question though.