The expression to be of legal age applies to a range of activities and situations. In general it may be described as ** the age at which a person enters into full adult legal rights and responsibilities** (Merriam Webster).
The specific age varies according to the rights concerned - whether sex, alcohol, arms or driving/flying and other licences. It also differs from country to country and, with regard to some rights, within the states/provinces of a country.
Where sex is concerned, certain activities are generally not permitted until those concerned have reached an age where they are thought to be sufficiently informed and responsible - often 16 or 18, although much lower in certain countries and cultures.
This is known as the age of consent and may well be lower than the legal age marking full adult rights and responsibilities.
So the teenagers would need to be at the age of consent to engage lawfully in a sexual act or in sexual activity (defined to exclude petting and other typical behaviour).
If they were too young, they could be said to be below the age of consent, (or specifically where sexual activity is concerned) not at the (required) legal age or not of legal age or below the legal age (but not at illegal age).