Yes, in most jurisdictions this is illegal. Because the younger person is a minor below the age of consent, such an act can be classified as statutory rape under the law, and the 18-year-old could face criminal charges and jail time.
Laws vary by state and country, so anyone with questions about a specific situation should consult the relevant local statutes or a legal professional.