That is a college rule only. In HS you have to declare a DH at the beginning or you can't get one. Also in HS the DH can hit for any position.
In college if there is no DH then the pitcher is his own DH. Later in the game you can bring in a reliever and allow the original pitcher to stay as the DH. Or, you could bring in a reliever and a different DH. Later you can bring a DH to pitch and then let him go back to being a DH. If he goes to any defensive position the DH is dead, but they don't consider pitching a defensive position. The NCAA DH rule is the most confusing rule in baseball. It covers four pages in the rulebook.