In most of the cases it is not, but in some cases, it can be. For example, if you are taking medication for an illness and you cannot sleep because of that medication, then it is a medical problem and not a habit-related problem. Your doctor may advise you some medication for falling asleep. Other than that, sleeplessness originates from your lifestyle and your environment. If you make some adjustments in both, you can start sleeping well.