While both instruments share some similarities, they are not exactly the same. A synthesizer is a electronic instrument capable of producing a wide variety of sounds, which can include sounds that mimic other instruments, including the piano. However, playing a synthesizer requires a different skill set than playing a piano.
Synthesizers often have more keys than traditional pianos (sometimes many more) and these keys can be smaller and closer together. Synthesizers also usually have various controls like knobs and buttons to adjust the sound, which are not present on a piano.
So, while knowing how to play piano might help you get started more quickly on a synthesizer, it is not a requirement. You can learn to play the synthesizer without any prior knowledge of the piano.