The basic sentence structure can broken down into three component parts:
- imperavi militi, "I ordered" - main clause, indicative
- ut flores conligeret, "the soldier to collect flowers" - indirect command, subjunctive
- qui in horto ambulabat/ambularet - relative clause inside the indirect command, also subjunctive.
Inside the ut flores conligeret is another subject, the subject of the verb. It's off that subject that I presume your exercise is leaning toward subjunctive.
However, if we look at some similar examples, we find in Caesar the indicative here:
L. Domitio Ap. Claudio consulibus discedens ab hibernis Caesar in Italiam, ut quotannis facere consuerat, legatis imperat quos legionibus praefecerat, uti quam plurimas possent hieme naves aedificandas veteresque reficiendas curarent.
Lucius Domitius and Appius Claudius being consuls [54 B.C.], Caesar, when departing from his winter quarters into Italy, as he had been accustomed to do yearly, commands the lieutenants whom he appointed over the legions to take care that during the winter as many ships as possible should be built, and the old repaired.
Additionally, if you look at Gildersleeve and Lodge §628 at the end, you find examples where it does not go into subjunctive. I think here could be one of those parts, if you so wished.
You could also use a different verb (like censeo) that doesn't introduce the ambiguity, or, if you're intent on keeping imperare, turn the relative clause into a participle: militi in horto ambulanti ut...