By Army regulations, no, he's not allowed to wear that uniform.
Prince Harry technically isn't a "retired officer". Rather, he resigned his commission in the Army, effective 19 June 2015. See the London Gazette for 11 August 2015, Supplement 61319, page 14838, under "Captain H. C. A. D. WALES 564673".
According to the Army Dress Regulations 02.45a (page 101 of the PDF), "It is to be
noted that those who resigned their commissions are not authorised to wear uniform
under any circumstances."
Moreover, under the Uniforms Act 1894:
(1)It shall not be lawful for any person not serving in Her [sic, now His] Majesty’s Military Forces to wear without Her Majesty’s permission the uniform of any of those forces, or any dress having the appearance or bearing any of the regimental or other distinctive marks of any such uniform: Provided that this enactment shall not prevent . . . . . . F1 any persons from wearing any uniform or dress in the course of a stage play performed in a place duly licensed or authorised for the public performance of stage plays, or in the course of a music hall or circus performance, or in the course of any bona fide military representation.
(2)If any person contravenes this section he shall be liable on summary conviction to a fine not exceeding [F2level 3 on the standard scale].
Clearly Prince Harry is not currently serving in His Majesty's Military Forces, and "His Majesty's permission" would by default be granted only through the Army Dress Regulations promulgated in his name. If Prince Harry were to wear the uniform anyway, then in principle he would be in breach of the regulations and thus the law, and liable for the prescribed fine.
Of course, if he had worn the uniform, it would presumably have been because his father the King had in fact granted him permission to do so (on which point His Majesty would presumably have solicited the advice of his ministers). But as a matter of politics and optics, that was probably not likely to be given. Throughout the prince's active military service, there was a concerted effort to make it appear (accurately or not) that he was serving under the same conditions as any other officer of the same rank, without receiving preferential treatment. So it would fit with that practice for him to comply strictly with the Army regulations, even though they could certainly be waived for his benefit.