Only close relatives can do that. Elephants and gorillas last shared a common ancestor more than 65 million years ago. Elephants evolved from shrew-like mammals living in Africa and that survived the mass extinction that wiped out the dinosaurs 65 million years ago. Gorillas evolved from shrew-like mammals that were living in Eurasia and that survived the same mass extinction.
They have evolved to be very different genetically and physically since that time. They have very different developmental genes, which are responsible for shaping their body. Their developmental genes are so different that they cannot mix with one another. For example, the developmental gene for elephants code for a long nose and big ears, but the gorillas genes code for a tiny nose and small ears. A developing embryo with such different genes will likely result in a miscarriage. In fact, it is likely that if you put the sperm of one species in a test tube with the egg of the other species, that fertilization will not even happen because their chromosomes are so different that they cannot line up and the cell will not divide, even if the sperm can penetrate the egg. Sperms need a chemical key to penetrate an egg, and only close relatives have chemical keys that are similar enough to permit entry. Distant relatives are unlikely to have chemical keys that are alike. Lots of animals reproduce by releasing sperms and eggs into the open ocean. Because of the chemical keys, we see very few hybrids. A clam's sperm is not likely to be able to penetrate an egg of a species of oysters for example.