Elle here from Shopify's Social Care team.
You can send a coupon code in your order confirmation email by customizing this template under Settings > Notifications. We have a handy guide on how to do this here. Here's a quick example of how I've customized the template:
Once you have the template customized, you can preview the email or send a test email from within the same page. Don't forget to do a test!
Of course, you'll need to create the coupon code first under the Discounts section. Here's our doc on creating discounts for your reference.
Hope this is helpful!