Insomnia can contribute and cause many health problems. Not only do anxiety and depression cause insomnia, but insomnia can also lead to anxiety and depression. So an extensive history by your physician is needed to determine what can what came first.
Now, in terms of medical problems, insomnia can lower your pain threshold, so pain syndromes such as arthritis, do become worse. It can also cause weight gain because you are sleep deprived, essentially. It causes an imbalance of hormones to control your appetite, which are leptin and ghrelin. Ghrelin is a hormone that helps you feel hungry. Leptin is a hormone that helps you feel satisfied after meals. So you're more hungry and less satisfied after meals, so you tend to eat more. It can also alter your metabolism, so it is harder to lose weight if you do have insomnia.
It can also lead to heart disease and cause a reduction in immune responses to illnesses and frequent colds. Insomnia can also lead to an increased risk for congestive heart failure for people who do have underlying heart disease.
So insomnia can lead to a multitude of health problems and you should follow up with your doctor to make sure that insomnia's not contributing to any of your health problems.