According to the Rambam, G-d does not change. This means that G-d never spoke to anyone. The Rambam writes in the first chapter of his Mishneh Torah that G-d created nature, a divine creation, and Moshe copied the governing rules of nature and produced the Torah, which is certainly divine. Now that we understand that G-d is immutable, we can try to comprehend how He responds to prayer. Philosophers like the Greek pagan Aristotle felt that prayers help improve people and are a time of self-reflection. The Hebrew word for prayer is lehitpaleil. The root is p-l-l, which means “judge.” Prayer means to "judge one’s self."
Maimonides, Aristotle's philosophical successor, felt that G-d does not listen to prayer. The world functions according to the laws of nature. Nothing we do will alter or change natural law. G-d is transcendent and it is impossible for us to describe Him. Any description we put will only remove our understanding of what G-d is. At best we can say that G-d has no body and is one. Rambam says that G-d's uniqueness and oneness are so One, that we cannot compare anything else to Him. G-d is One but not in the unity of one. For instance, if I take a chair and say, "Surely this is one chair," it is not really one since it is made up of many components, that make up the chair. G-d is unlike this chair which if disassembled, will have legs, cushions, seats, etc.
Since G-d is One, it follows that G-d cannot change. If G-d cannot change, G-d cannot become angry when you sin and be happy the next when you make teshuva by making a prayer. Thus, G-d does not have emotions and He does not listen to prayer. This is, to my humble understanding, the Rambam's view on prayer (but it is by no means all of Judaism's view on prayer).