Really, where do Transformers come from?
The exact process for creating new transformers shifted around a bit in the generation one continuity. Sometimes new Transformers could just be built, and then off the went, other times some sort of catalyst was required, commonly the "Creation Matrix" that Optimus Prime possessed. Really, though, it seemed to be up to the whim of whomever was writing the comic or cartoon episode at that moment. Ever since then, depending on what cartoon, comic, or movie you're looking at, it varies quite a bit, although most commonly, it's now depicted are relying on some sort of catalyst, like the Allspark in the live action movies.
For me, this leads to thinking about where Transformers as a race come from.
In the Generation 1 cartoon, Transformers were built by an alien race, called the Quintessons, as a product to be sold.
In the comic version of Generation 1, the Transformers were created by a primal god of the universe, Primus, who consciousness was trapped inside a planet as the result of a great battle, eventually that planet became Cybertron, and the beings on it were gifted with the ability of transformation by their god.
Personally, I prefer the former, just because I don't like the idea of religion being a fact, rather than a faith. I'm okay with the idea of robots having the concepts of souls (or sparks, if you well) and afterlives, because it makes them more human, and thus sympathetic. They should question whether or not they'll go to a better place when they die, or if the supposed teachings of their gods and prophets are actually legitimate, if you take that away from them, giving them gods that walk amongst them, and souls that they actually have to place into blank bodies to make new members of the race, it's no longer a religion, and is just the way things are.
I'm getting off point though. Those are just two of the more common options used for the the Transformers Mythos. Here are some other options of have a race of Transformers could come to be, and how they might reproduce:
1. Naturally occurring metallic organisms. Cybertron is a life supporting planet like Earth, except that many of the species are metallic in nature. Meaning that the Transformers are actual living organisms, and are capable of reproduction, growth, must consume something for sustenance, and likely need to generate waste as well.
This is actually touched on a little by the tie in comics for the live action movies. They hypothesize that the ammunition used by the Transformers is actually grown, similar to human fingernails.
Why would such an organism evolve the ability to transform? Survival, it would be a form of camouflage, either to hide themselves from larger predators, or to remain undetected by prey.
As for reproduction, since these are organisms, they could reproduce in a similar to fashion to any Earth organism. They could lay eggs, birth live young, simply split apart into multiple entities once they've grown large or old enough. They could reproduce asexually, or it could require multiple parties and/or multiple genders.
Creepy, I know.
2. Post organic life forms. Once an organically evolved life form, that slowly integrated more and more machinery into its body, until eventually, nothing organic was left, or at least very little. In this scenario, transformation would simply be towards the purpose of utility, one would have a highly adaptable form (robot mode) and a more specialized form which would leverage all of the extra motors and mechanical strength towards a few more simple applications.
How would such creatures reproduce? I doubt they would retain any of their biological functions towards this end. It's possible that they could simple live a finite existence at this point, with their numbers no longer increasing, or at least only rarely. If they have completely digitized their minds, I suppose there wouldn't be anything preventing them from simply duplicating themselves in new bodies.
3. Emergent AIs. Here we have artificial intelligences created by another race, which eventually gained sentience. This would be sort of the reverse of the last option, instead of humanoids developing the ability to turn into specialized machinery, they would be specialized machinery with the ability to become a more versatile form.
Reproduction would be similar, again with copying, although it could also occur that aspects of the AI would slowly grow in complexity, until they too, became self aware, at which point they may separate from their progenitor, and take on their own physical body.
4. This really fits more in with the religious aspects, but what if Transformer sentience was some sort of mystical, little understand "soul" energy. Why such creatures would transform is anyone's guess, but as for reproduction, perhaps this energy would slowly grow over time, the greater the energy, the larger body it can sustain, eventually they could become city or planet sized. As an alternative to growing larger, they could transfer their energy to another machine, and thus give it sentience and the ability to transform. There would have to be some sort of imperative to not just hoard energy, perhaps having a surplus becomes painful, or damaging?
Anyway, there's my idle rambling, hope someone has fun.