Gilbert joined the volunteer army later than many of his contemporaries, enlisting in October 1862. Nevertheless, he was appointed colonel of the 27th Iowa Volunteer Infantry Regiment on October 3, 1862. Gilbert's regiment participated in Frederick Steele's Little Rock Expedition but was not involved in any fighting. He was posted to garrison duty in Arkansas and then transferred to Mississippi where his regiment was attached to Andrew J. Smith's division in the XVI Corps during the Meridian expedition.