Wisdom rules out a purposeless demand. In the context of divine law, a prescribed act has a legally appropriate good connected to it, even where human reason does not grasp every detail of that good.
This is not a claim that every human command must be beneficial: an ignorant or unjust person can command wrongly. The discussion concerns the Wise Lawgiver and the significance of His prescriptions.
Prayer is commanded as worship. Yet its intrinsic merit does not allow reason alone to determine its number of cycles, appointed hours, or particular conditions; these require revelation.