You are experiencing what is called a "squeeze" in the dive world. Water has weight, and as you go deeper the water above you gets heavier. It exerts more and more pressure on your body the deeper you go. The air spaces inside your body (i.e. behind your ear drums) however remain at the same pressure. This causes your eardrum to be pushed inward. This is called a squeeze. The same thing happens to the air in your mask. As you go deeper, your mask is sucked tighter and tighter to your face. That is called a mask squeeze.
You can avoid these painful squeezes altogether by "equalizing". Simply put, equalizing is just adding air to these air spaces so that the pressure inside matches the water pressure outside. Pinch your nose and then try to blow it.........what happened? Your ears popped didnt they? What happened is that you increased the pressure on the backside of your eardrums by adding air to them. To avoid a mask squeeze, you just exhale through your nose into your mask....adding air to your mask.
The opposite is true when you ascend from depths. The pressure on the outside decreases. Usually just normal breathing allows the differential pressures to equalize on ascent. Unless of course you have a bad head cold or other condition which causes nasal and sinus congestion. In cases of this type congestion, you can experience what is called a "reverse block". Simply put, a reverse block is when the over pressure inside your sinus' or ears cannot equalize because its stopped up by congestion, which is also painful. To alleviate pain from this, just descend a few feet, take off your mask, blow your nose real well, put your mask back on, and try to ascend again slowly. First thing to know though is that if your congested to begin with......dont dive!!
You will learn all about this stuff in your classes. I used to worry too about my ears and being able to equalize. I never could equalize when snorkeling. Its difficult to equalize without scuba because you dont have a ready supply of air to use for the equalizing process.
One more thing....Always equalize EARLY....before feeling any pain or discomfort. Usually, once a squeeze has reached the point of being painful....its too late to equalize. Equalize early and equalize often. During descents, I usually equalize once per breath of my regulator, or about every 10 seconds.