If the reason for leaving is due only to genuine and serious medical reasons, the employer may permit you to leave the job either by relaxing the notice condition partially or totally or by waiving it on the ground of inability of performance of the contract by you. Otherwise, you have to pay the notice amount to get a proper relief.
By the by, within 6 days of joining, your unexplained urge to resign indicates two things -i.e you are not serious about the process of recruitment and appointment and your wavering tendency as well. Whatever it be, if you are willing to abide by the terms of the contract of employment you have just accepted, your relief would be hassle-free. In future, it would be better to be serious in accepting employment offers.