If two bodies such as Earth and Mars were to collide directly they would both completely disintegrate, there would be nothing left that looked like a planet, it would look more like a bunch of really big asteroids flying everywhere. Eventually gravity will take hold and gather most of the debris back together to form planets again.
If the two bodies were to graze each other, meaning not hitting dead on, then the smaller of the two would disintegrate, the larger body would also take a heavy toll (there are so many variables here, velocity and angle of impact play a role along with many other factors) But, the smaller body which gets ripped apart will form a ring of debris around the larger body, eventually coming together to form a moon
In fact, a Mars-sized object collided with the Earth, just grazing it, during the formation of the solar system which in turn made the moon. This is the most accepted theory on the formation of our moon, as we have a rather large moon for the size of our planet, also our moon is made of the same material as the Earth. Look up how the moon was created, it almost perfectly answers your question.
So to answer your question in short, Either both planets get destroyed and gravity eventually collects the debris back together, or one gets destroyed- possibly becoming the moon(s) of the other body