UDI, the Norwegian Directorate of Immigration, determines if you are entitled to stay in Norway.
You also need to check if you have health insurance from your home country. If you don't, you should check with NAV whether you are entitled to join the Norwegian national insurance scheme (in Norwegian).
If you are a member of the Norwegian national insurance scheme while you are studying in Norway, you will be entitled to subsidised health care from the public health care system. You should still consider taking out private health insurance. This can be used, for example, to meet the costs of medical transport back to your home country if you fall ill.
If you are covered neither by the Norwegian national insurance scheme nor by health insurance from your home country, you should make sure you take out private comprehensive health insurance.
Example: Zahra from Iran is taking a master's degree in mathematics at the Norwegian University of Science and Technology in Trondheim. She is a member of the Norwegian national insurance scheme and therefore receives health care in the same way as Norwegian citizens. She is in a road accident and suffers a serious spinal injury. Zahra wants to return home to Iran as quickly as possible. Fortunately, she has taken out travel insurance that covers medical transport back to her home country in the event of illness.