No, that was Challenge of the Go-Bots were they developed the ability to transform as part of the war. Though I haven't seen every episode of Transformers G1, they could have put it into an episode that I didn't see. There were at least two mutually exclusive origins for both the Dinobots and Constructions in the cartoon, after all. But like I said, the standard explanation was that they were built as a slave race by the Quintessons with the ability to transform as part of their roles: Autobots, built for domestic labor and construction, turned mostly into cars and trucks, while Decepticons, built primarily for combat, mostly turned into jets and other war machines.
In the comics, Transformers had "evolved from naturally occurring pullies and gears" and the ability to transform was innate from the get-go.