In shulchan aruch (siman 2, saif 6) the author writes:
It is forbidden to walk in an erect posture.
Does this mean that good posture is forbidden or is the author referring to something else?
The Aruch Hashulchan Siman 2 Sif 9 addresses your issue directly. He says 'erect posture' doesn't mean that therefore one should walk hunchbacked, rather he shouldn't walk with his 'neck sticking out like a haughty person'.
The Kitzur Shulchan Aruch in the beginning of 3:7 gives more detail on what's considered an appropriate 'level' of 'head holding':
אָסוּר לֵילֵךְ בְּקוֹמָה זְקוּפָה וְגָרוֹן נָטוּי, כָּעִנְיָן שֶׁנֶּאֱמַר, וַתֵּלַכְנָה נְטוּיוֹת גָּרוֹן וְגוֹ' (אוֹרַח חַיִּים שָׁם). וּמִכָּל מָקוֹם לֹא יָכוֹף רֹאשׁוֹ יוֹתֵר מִדַּאי, אֶלָּא בְּמִדָּה בֵינוֹנִית, בִּכְדֵי שֶׁיִּרְאֶה אֶת הַבָּא כְּנֶגֶד פָּנָיו וְגַם יִרְאֶה מִדְרַךְ כַּף רַגְלוֹ (הר"י בספר היראה).
You should not walk with an upright [haughty] posture and an outstretched neck, as it is said: "And they walked with outstretched necks."13 Nevertheless, you should not bend your head excessively, but only moderately so that you will be able to see anyone approaching you and also see where you are walking. (Rabbeinu Yonah in Sefer Hayirah).
In short, keep your head high enough that you can see where you're going, but not at a height that is considered 'haughty'.