Reproduction in jawed vertebrates (gnathostomes) involves either external or internal fertilization. It has commonly been argued that internal fertilization can evolve from external, but not the reverse. However the fossil record has thrown multiple spanners into the works.
Placoderms are an extinct group of armoured fishes that are widely resolved as a paraphyletic grade of basal gnathostomes (ie. All modern jawed vertebrates evolved from placoderms). Paired claspers have been found in advanced placoderms (arthrodires and ptyctodonts), suggesting that copulation might actually be the primitive state for Gnathostomata. However, without data on the reproduction of more primitive forms, it could be argued that these were specialized features of certain placoderm subgroups.
Now we have discovered that antiarchs, the most primitive jawed vertebrates in the fossil record, engaged in penetrative copulation. Key to this discovery is little Microbrachius, a small Middle Devonian antiarch (about the size and shape of a modern Corydoras catfish) originally described from Traquair back in 1886 and known from Scotland, Estonia and China. Numerous newly discovered specimens from the Orkney Islands have revealed that mature males bore proportionally enormous bony claspers.
These were serious and brutal-looking man-tools, the ventral surface consisting of a slender trunk extending from the rear of the body armour, bearing transverse ribs covered in small knobs, followed by a section bearing whopping great spikes and finally a huge blade like lateral prong that was presumably for insertion. The dorsal surface was smooth, bearing a prominent sperm-channel that was probably covered in soft tissue in life. The female had some impressive genital gear as well – a pair of flat bony plates flanking her cloaca with rows of tiny hooks on the dorsal surface. Female genital plates have also been identified in the antiarchs Pterichthyodes and Bothriolepis (male claspers are so far only known from Microbrachius).
This strongly infers that copulation first appeared very deep in the history of jawed vertebrates. We have compelling evidence that internal fertilization is the default setting for the Gnathostomata and thus spawning (shedding large quantities of eggs and sperm into the surrounding water, as practiced by most living fish and frogs), despite long being considered a "primitive" feature, is in fact a derived state in jawed vertebrates.
*Yes, Traquair really did name it dicki roughly 1.3 centuries before we discovered it had giant bony male intromittant organs. Robert Dick was a 19th century Scottish fossil hunter who provided the first specimens of this fish.