An Aviation Medical Examiner (AME) usually provides a student a form for you to complete during the medical exam, but you can get the online application from the FAA with MedXpress.
A student pilot certificate remains valid for 24 months, whereas a third class medical can last up to 36 months, depending on your age during your visit to the AME. If your student pilot certificate expires before the medical, you can obtain a replacement from a Designated Pilot Examiner (DPE) or your local Flight Standards District Office (FSDO).