The prophet who dares to speak in My Name something I did not command him… (Deuteronomy 18:20)
It is prohibited for a person who is not actually a prophet to set himself up as one, saying things in the Name of God that were never Divinely communicated to him. This is the case even if the message is a legitimate prophecy that was delivered to another person that the faker is passing off as his own. We see this from the phrase “that I (i.e., God) did not command him” (Deuteronomy 18:20). The message may have been given to a prophet to deliver but if you are not the one who was so commanded, you may not take the job for your own.
The basis of this mitzvah is that the prophets are relied upon to deliver the word of God, which is absolute truth. Liars posing as prophets muddy the waters by mixing His word with falsehood. Furthermore, when the false prophets are revealed as such, it shakes the people’s faith in the real deal. (All this is also the case with the one who passes off another’s prophecy as his own. While the message may come true, the liar has falsely earned a reputation as a great and pious individual, which he clearly is not. People will continue to turn to him for guidance which he is not truly suited to give.)
This mitzvah applies in all times and places. It is discussed in the Talmud in tractate Sanhedrin (89a-b) and codified in the Mishneh Torah in the fifth chapter of Hilchos Avodas Kochavim. This mitzvah is #27 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #175 of the 194 negative mitzvos that can be observed today in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.