The general ban on making pornographic material available to minors also is relevant to sexting, if the receiver is less than 18.
The total and exceptionless ban on making and possessing child pornography also applies to sexting: Child pornography is images of a sexual nature if the person on any of the images is less than 14. There is no exception: if the image's subject is less than 14 years old, it is illegal material for anyone to possess, make, or transfer.
Kids however are "Strafunmündig" and can not be prosecuted. (StGB §19)
Also relevant in this regard would be 176a, which includes making a minor under 14 do sexual acts, including by providing pornographic material.
Is the subject of the image 14 to 18, then this paragraph applies. In contrast to the exceptionless ban on child pornography, there is a tiny exception if some factors are given: First, the picture's subject needs to consent. Second, the image may only exist for purely personal use of the sender and intended recipient.
Do note that any form of duress or pressure on the youth would invalidate consent, and showing the picture to anyone but the intended recipient would invalidate purely personal use.
Conclusion
Sexting is highly illegal for anyone under 14, even if consensual.
With 14 and up to the 18th birthday (Which is a Jugendlicher under §1 JGG), there is some limelight if both are in this age bracket, no pressure is applied and the images are never shared beyond the original recipient.
Adults sexting their images to juveniles is illegal, as you are not allowed to give them pornographic material, no exception. They would be allowed to receive such material, but sending explicit material back would be making available pornography to someone under 18.