You can get a hair transplant without medications; however, if you are under 30 and/or had recent hair loss, then shock loss is a high risk without taking oral finasteride prior to the surgery.
Early hair loss is the problem. Anyone whose hair loss is recent, will usually have miniaturization that is extensive. It is these early miniaturized hairs that fall out. Most men above 30-35 have already lost their miniaturized hairs. Finasteride holds on to these hairs in the face of a hair transplant.