Implant-related infection may be catastrophic and result in poor functional outcome, chronic osteomyelitis, implant failure or even sepsis and death. Based on a transglutaminase (TGase) cross-linked/antibiotics-encapsulated gelatin-alginate hydrogel, the main aim of this study is to establish an effective antibiotic slow-release system. The second aim is to evaluate the efficacy of a hydrogel-encapsulated antibiotic-containing titanium pin in preventing implant-related infections in a rat model. The prepared gelatin/alginate/gentamicin or vancomycin hydrogel was covalently cross-linked with transglutaminase (TGase). Its drug release profile and cytotoxicity were determined and the Wistar rat animal model was performed to validate its efficacy by radiographic examination, Micro-CT (computed tomography) evaluation and histo-morphological analysis at 12 weeks after surgery. When gelatin and alginate were thoroughly mixed with TGase, both 0.5% and 1.0% TGase can effectively cross link the hydrogel; the release of antibiotic is slowed down with higher degree of TGase concentration (from 20 min to more than 120 h). In the animal study, antibiotic-impregnated hydrogel is effective in alleviating the implant-related infections. Relative to that of a positive control group, the experimental group (vancomycin treatment group) showed significant higher bone volume, more intact bony structure with only mild inflammatory cell infiltration. This newly designed hydrogel can effectively deliver antibiotics to reduce bacterial colonization and biofilm formation on the implant surface. The remaining challenges will be to confer different potent antibacterial medications with good biocompatibility and fulfill the safety, practical and economic criteria for future clinical translation.