There is no question that the practice of Jewish men covering their head is universal among Torah-observant Jews. However, many of the Talmudic sources discussing the issue imply that it is not necessarily an obligation, but a “middas chassidus,” an admirable custom of the pious. For example, the fact that R’ Huna the son of R’ Yehoshua was singled out as being careful not to walk four amos (cubits) with his head uncovered seems to indicate that most others did not do so. Here is what the poskim have to say on the matter:
The Tur (Orach Chaim § 2) lists the covering of one’s head among the morning routine, refering to R’ Huna’s statement that he would not walk four amos without a head covering. Also, when discussing the laws of tzitzis (id. § 8), the Tur states that when one wears a tallis, he should cover his head.
Puzzled by the Tur’s comment in hilchos tzitzis, the Beis Yosef (id.) wonders why it was necessary for the Tur to repeat that one must cover his head. Because of the Tur’s first statement in § 2, the Beis Yosef takes for granted that one must already have his head covered by the time he is ready to wear a tallis. Consequently, the Beis Yosef reasons, the Tur must be referring to an extra head covering worn by those who are married. Thus, the Tur means that one should cover his head with the tallis, either because it as an extra sign of fear of God or because it is the ideal way to fulfill the mitzvah of tzitzis.
The Darchei Moshe (Orach Chaim § 8) takes issue with the Beis Yosef’s explanation of the Tur and his assumption that it is an actual prohibition to walk without a head covering. In Darchei Moshe’s view, the Talmudic sources clearly indicate that covering one’s head is no more than an admirable practice, and this is the meaning of the Tur’s statement in § 2. When the Tur again says that one must cover his head with the tallis, it is because until then it is not an obligation.
Although in the Beis Yosef R’ Yosef Karo seems to manitain that it is an actually prohibition to go with an uncovered head, his wording in Shulchan Aruch (Orach Chaim § 2(6)) indicates otherwise. His words there are: “It is prohibited to walk with an upright (haughty) posture, and one should not walk four amos with an uncovered head . . . .” The fact that the Shulchan Aruch distinguishes between walking upright (which is “prohibited”) and walking without a head covering (which one “should not do”), implies that the latter is not an actual prohibition, but a preferred course of action (see Yad Efraim, ad loc.). Also, the Magen Avraham (Orach Chaim § 91(3)) states that the Shulchan Aruch’s opinion is that covering one’s head is only a pious practice.