I presume we mean the (would-be) Hohenzollern Emperor of the post-1871 German Empire, and not the Habsburg Holy Roman Emperor (King of Germany) Frederick III?
Assuming that everything else goes more or less as IOTL, then when William I dies in 1888 his heir would Albert, son of William's younger brother, Prince Albert of Prussia. IOTL he had three male heirs, so the succession would be ensured.