The assumption "if they knew he would turn into a zombie after death", is not necessarily correct. In the TV show, it is shown that none of the main characters are aware that
people who die naturally become zombies until the episode "Better Angels". Until then, the main characters assumed that zombie bites or saliva turn you into a zombie.
This fact was not necessarily known when the hospital was cleared by the military and it has been shown that conflicting or bad information (such as instructions for the public to go to Atlanta) was a large problem during the initial outbreak. If the military believed that only zombie bites or saliva contact during life would reanimate you as a walker in death, then one could assume they would leave Rick alone - if they even got that far.
As @Secko mentioned, there is not any evidence that the military thoroughly searched and cleared the hospital in the first episode.