Thank you for your question. I look forward to working with you to provide you the information you are seeking for educational purposes only.
This right is conferred by Congress in law by 10 US Code 772 Section (e):
See: 10 USC Sec. 772 01/03/2012 (112-90) TITLE 10 - ARMED FORCES Subtitle A - General Military Law PART II - PERSONNEL CHAPTER 45 - THE UNIFORM
Sec. 772. When wearing by persons not on active duty authorized
(c) A retired officer of the Army, Navy, Air Force, or Marine Corps may bear the title and wear the uniform of his retired grade.
(e) A person not on active duty who served honorably in time of war in the Army, Navy, Air Force, or Marine Corps may bear the title, and, when authorized by regulations prescribed by the President, wear the uniform, of the highest grade held by him during that war.
SOURCE (Aug. 10, 1956, ch. 1041, 70A Stat. 35; Pub. L. 99-145, title XIII, Sec. 1301(a)(1), Nov. 8, 1985, 99 Stat. 735; Pub. L. 101-189, div. A, title XVI, Sec. 1621(a)(1), Nov. 29, 1989, 103 Stat. 1602; Pub. L. 104-201, div. A, title V, Sec. 551(b), Sept. 23, 1996, 110 Stat. 2525.)