"foundation" in this sense was more than just the stone blocks to support the temple walls. It included the entire temple floor set in stone. This enabled all the temple worshipers to wear their special garments and keep them clean.
The hand of a king is a metonym for the power to give commands. Alternate translation: "as David ... had commanded" (See: [[rc://en/ta/man/translate/figs-metonymy]])