Condition-based maintenance (CBM) is an effective way to keep the safety of industrial equipment by predicting the remaining useful life (RUL) and scheduling the maintenance plan before failure. Condition monitoring data is the basis of health state evaluation and RUL prediction. In ideal cases, the monitoring data are collected consecutively starting from the healthy stage until the end of the lifetime. In real industrial cases, however, fragment data often exist due to the interruption of monitoring and/or the loss of sensor readings. The major characteristic of fragment data is that they only record a random period of degradation process. The initial degradation time information is generally lost. Therefore, it is unable to be modeled using the common time-dependent modeling framework. To deal with the above issue, this paper proposes a nonparametric degradation modeling method for RUL prediction with fragment data. In this method, a new state-dependent degradation modeling framework is constructed via two-step axis transform. It formulates the RUL using a function depending on the health state. Based on functional principle component analysis (FPCA), a principal analysis via maximum likelihood estimation (PAMLE) algorithm is developed to recover the missing data of failed units. In addition, a RUL prediction-oriented optimization (POO) algorithm is proposed to predict the RUL of in-service units based on a piece of fragment data. Consequently, the proposed method is capable of dealing with the issues of both data recovery and RUL prediction. The effectiveness of the method is demonstrated using a fatigue crack growth dataset and a lithium-ion (Li-ion) battery degradation dataset.