While you should always try to choose teachers who know you well for your recommendation letters, sometimes, you have no option. You should only use this option if the school you are applying to requires a letter of recommendation and you have not established a relationship with any teachers or counselors. Otherwise, you should always ask someone who knows you well. When asking someone you don't know well, the best option can often be asking them in person and then telling them more about who you are.
If the first conversation goes well, you can send a follow up email more information and consider requesting another meeting. Since they don't know you well, be sure to have a resume and a summary of your time and accomplishments in their class.