In my understanding of Jewish tradition, orthodox Jewish men cover their heads to show their respect for God. The Jewish professor had been brought to the Ten Boom home by the underground; he had probably been among the Jews taken in the dead of night by the Nazis for deportation. If that had been the case, he would not have had time to bring anything with him, including a head-covering, which is not worn while sleeping. The professor had more than likely been spirited away by the underground in the nick of time, with nothing more in his possession than the clothes on his back.
It would be especially important for a Jewish male to cover his head during prayer, a time when he presents himself specifically in the presence of God in a very special way. When he is asked by Casper Ten Boom to pray for the meal at the Ten Boom house, the professor, having nothing at hand with which to cover his head, uses the only thing at his disposal - his hand - to cover his head and show his respect while addressing his Creator. Being unable to follow the letter of the law by using a proper yarmulke, the professor nonetheless observes the spirit of the law by using his hand to cover his head instead during prayer.