You're probably hearing the blood flowing through blood vessels in the ear area. When you have your ear on a pillow or mattress, you're blocking out environmental noises, so the normal noises of circulation become audible.
Usually not a sign of a significant problem. Changing position usually helps. Be sure to get your blood pressure checked to be sure that is not an issue.