From Halopedia, the Halo wiki
In Halo Wars, Warthogs are lightly armored, fast and nimble scout units. They are player's first unit and do not have any damage capability other than running things over. Along with infantry units, they can be used to collect discovered resource crates. A Warthog cost 150 resources to construct at the command center and a unit takes up one population.
Sergeant Forge can mount the Warthog and in result the Warthog instantly upgraded into Gauss Hog which was unique to Sergeant Forge.
Halo Wars 2
In Halo Wars 2, Warthogs share the same role they did in Halo Wars. Basic Warthogs are now equipped with an M41 Vulcan by default, and can be upgraded with Gauss Cannons from the Garage. They are very dependable for reconning areas aside the Jackrabbit.
Warthog Upgrade: Gauss Cannon