You can't actually "fail" the ASVAB, but you can "fail" to achieve a high enough AFQT score to enlist in the service you want. If this happens, that means your AFQT score was too low which - in turn, means you need to work on one (or more) of four areas: math knowledge skills, arithmetic reasoning skills, reading comprehension skills, and word knowledge skills. These are the four subtests that are used to calculate your AFQT score.
Once you're sure that you are ready, you can apply (through your recruiter) for a retest.
Minimum Waiting Times
ASVAB tests are valid for two years, as long as you are not in the military. In most cases, once you join the military, your ASVAB scores remain valid as long as you are in. In other words, except in a few cases, you can use your enlistment ASVAB scores to qualify for retraining years later.
After you take an initial ASVAB test (taking the ASVAB in high school does not count as an initial test), you can retake the test after 30 days. After the retest, you must wait at least six months before taking the ASVAB again.
When you retake the ASVAB, it's not your highest score that counts, but rather the score on your latest test. If you score lower on the retest, that is the score that will be used for your military enlistment.
When You Can/Cannot Re-Take the Test
The bad news is that you can't retake the ASVAB on a whim or whenever you simply feel like it. Each of the services has its own rules concerning whether or not they will allow a retest:
The Army will allow a retest only if the applicant's previous ASVAB test has expired, or the applicant failed to achieve an AFQT score high enough to qualify for enlistment, or when unusual circumstances occur, such as if an applicant, through no fault of their own, is unable to complete the test. For example, an applicant is called away from testing because of an emergency. Army recruiters are not allowed to schedule a retest for the sole purpose of increasing scores to qualify for enlistment incentives, job qualifications, or other special enlistment programs.
The Air Force does not allow retesting applicants after they have enlisted in the Delayed Entry Program (DEP). Current policy allows retesting of applicants who are not holding a job/aptitude area reservation and/or are not in DEP but already have a qualifying AFQT score. Retesting is authorized when the applicant's current line scores (job qualification scores) limit the ability to match an Air Force skill with their qualifications.
The Navy allows retesting of applicants whose previous ASVAB test has expired, or if the applicant fails to achieve a qualifying AFQT score for enlistment in the Navy. In most cases, individuals in the DEP cannot re-test. One notable exception is the Navy's DEP Enrichment Program. This program provides for the provisional DEP enlistment of high school diploma graduates with AFQT scores between 28 and 30. Individuals enlisted under the program are enrolled in academic enhancement training, retested with the ASVAB, and accessed onto active duty provided they score 31 or higher on the subsequent ASVAB re-test.
The Marine Corps will authorize a retest if the applicant's previous test is expired. Otherwise, recruiters can request a retest as long as the retesting is being required because the initial scores (considering the applicant's education, training, and experience) do not appear to reflect their true capability. Additionally, the retest cannot be requested solely because the applicant's initial test scores did not meet the standards prescribed for specific military job qualification.
For Coast Guard enlistments, six months must elapse since an applicant's last test before he or she may retest solely for the purpose of raising scores to qualify for a particular enlistment option. The Coast Guard Recruiting Center may authorize retesting after 30 days have passed from an initial ASVAB test if substantial reason exists to believe the initial AFQT score or subtest scores do not reflect an applicant's education, training or experience.