If a person or organism is said to be immunocompromised, that means that their body's natural immune system is damaged and not working at a sufficient capacity. The human body is constantly bombarded by microorganisms over time (microorganisms are by far the most abundant form of life on Earth). Many of these microbes are neutral to humans. Some are beneficial, such are microbes in the intestines to aid in food digestion. But many are harmful, and the natural immune system of a healthy human provides constant protection to neutralize them before they can make a person ill. A person suffering from AIDS is an extreme example of an immunocompromised person.
Microorganisms enter the body at every conceivable point of entry, from the air we breathe to the food and water we consume. Mucous membranes are moist tissue linings that are particularly susceptible to germ entry into the body. Most mucous membranes are contained within the body and are thus protected by the skin, but some are exposed such as the eyes. So a fungal microbe that enters through the eyes will be less likely to be neutralized in an immunocompromised person, thus making them more susceptible to infection.
If someone's immune system is compromised, it means that the body's defense system against illness and infection is impaired or weakened in some way. This means that something that a person with a healthy immune system might easily fight off can get into the body of the person who's immune system is compromised in some way. The body has a few different defense against fungal infections, specifically. Our intact skin, naturally occurring chemicals, changing of skin cells, and even its over anti-fungal substance secreted by mucous membranes. Some of the fungi that cause disease already live in our bodies, but immune systems are able to deal with them. This is why, when a person gets a fungal infection, in the eye or otherwise, it is more likely that he or she has a weakened (compromised) immune system than a healthy one.