Visit Microsoft's DirectX page to download the appropriate version. Once you're on the download page, select the appropriate link for your version of Windows.
Tip: If you have a game requiring Microsoft DirectX that prompts to install DirectX on the computer, it also has a folder called DirectX on the CD or DVD. Also, keep in mind what version the game is attempting to install on the computer. Some games may want to install an older version of DirectX on the computer, but you should always use the latest version of DirectX.