Although the exact cause is unknown, risk factors for developing keratoacanthoma may include excessive sun exposure, a weakened immune system, and certain genetic factors.