Berachos 10b
א״ר יוסי בר׳ חנינא משום ראב״י המתפלל צריך שיכוין את רגליו שנאמר ורגליהם רגל ישרה
This is brought in the Rambam Tefilla 5:4 (part of תיקון הגוף for תפילה along with how to hold ones hands and where ones eyes should be, which may be understood as how to stand in front of the King) and the Smag Asei 19 (good way to remember it is that we have 19 berachos in our "shmonah esrei") and Shulchan Aruch OC 95:1, and see MB 1 that one fulfills his obligation post facto if his legs were not aligned.