edited: I have a problem in which, a map $f: (S, \star)\rightarrow (S', \cdot)$ such that $f(e)=e'$, where $e$ and $e'$ are identities of $S$ and $S'$, respectively, and for all $x, y\in S$, we get $f(x\star y)=f(p)\cdot f(q)$, where $p, q\in S$ and $f(p), f(q)\in S'$. Can such mappings be called a homomorphism? If not, is there any name for such mappings?
Note $p$ and $q$ may be distinct from $x$ and $y$, respectively. Whereas, in standard definition of a monoid homomorphism, we have for all $x, y\in S$ implies that $f(x\star y)=f(x)\cdot f(y)$.
[Posting more or less what I said in the comment thread, plus a bit extra.]
Any homomorphism $f : (S, \star) \to (S', \cdot)$ satisfies the property in your question: just take $p=x$ and $q=y$.
When $f$ is not injective, it's possible to have $f(x \star y) = f(p) \cdot f(q)$ with $p \ne x$ and $q \ne y$—as long as $f(x)=f(p)$ and $f(y)=f(q)$ you're good to go. For example, for example the homomorphism $$f : (\mathbb{Z}, +) \to (\mathbb{Z}_2, +_2)$$ given by $f(n) = (n \bmod 2)$ for all $n \in \mathbb{Z}$ satisfies $f(1+5) = f(3) +_2 f(7)$.
However, if your definition is:
Then such functions might not be homomorphisms. As a trivial example, define $f : (\mathbb{Z}_3, +_3) \to (\mathbb{Z}, +)$ by $f(0)=f(1)=0$ and $f(2)=1$. This is most certainly not a homomorphism, since for example $$f(2 +_3 2) = f(1) = 0 \quad \text{but} \quad f(2) + f(2) = 1+1 = 2$$ But it satisfies the property in your question, since the only values of $f$ are $0=f(0)+f(0)$ and $1 = f(0)+f(2)$.
I can't see a reason why such functions would be useful, so I very much doubt they have a name.