Godwin was commissioned as an Ensign into the 9th Foot on 30 October 1799. He served with the regiment at Ferrol in 1800 and was promoted Lieutenant on 9 August 1803. In an expedition to Hanover in 1805 he served as adjutant of his battalion. In 1808, at the outset of the Peninsular War, Godwin was in Portugal and was promoted Captain on 28 March 1808. The next year he took part in operations on the Douro and in the advance to Porto, then marched with his battalion to Gibraltar and later to Tarifa. He volunteered to follow Blayney in an attack on Fuengirola and later commanded two companies at the Siege of Cadiz. He fought at the defence of Tarifa in 1811, was severely wounded at the Battle of Barrosa on 5 March 1811, and ended the war as a brevet Major and a Companion of the Order of the Bath.