The application of ketoconazole (KET) in ocular drug delivery is restricted by its poor aqueous solubility though its broad-spectrum antifungal activity. The aim of this study is to develop an ion-sensitive
in situ
gel (ISG) of KET to promote its ocular bioavailability in topical application. The solubility of KET in water was increased by complexation with hydroxypropyl-β-cyclodextrin (HPβCD), then KET-HPβCD inclusion complex (KET-IC) was fabricated into an ion-sensitive ISG triggered by sodium alginate (SA). The
in vitro
drug release and antifungal activities investigations demonstrated that the KET-IC-ISG formulation increased drug release and anti-fungal activities compared to pure KET. The
ex vivo
rabbit corneal permeation studied demonstrated higher permeability of KET-IC-ISG formulation (
P
app
of (6.34
0.21)
10
−4
cm/h) than pure KET (
P
app
of (3.09
0.09)
10
−4
cm/h). The cytotoxicity assay and the ocular irritation study in rabbits confirmed the KET-IC-ISG safety and well tolerance. The ocular pharmacokinetics of KET in rabbits was investigated and the results showed that the KET-IC-ISG increased its bioavailability in cornea by 47-fold. In conclusion, the KET-IC-ISG system promoted the precorneal retention, the ocular drug bioavailability and the developed formulation is a potential strategy to treat mycotic keratitis.