Black toenails can be caused by a fungal infection, which is common in immuno-compromised patients, or they may indicate underlying melanoma (a malignant tumor consisting of dark-pigmented cells called melanocytes).