It comes from the Officer Corps. One may not respect the individual officer but one must respect the rank. It's the assumption that by virtue of obtaining the position one should be respected - but not always. But the position itself is one of respect.