Reproduce the system() function of linux
Enable compiler warnings and fix all of them

I immediately see that your function my_system(), which should return an int, does not contain a return statement. That means the return value is undefined. If you enable compiler warnings, the compiler will complain about such mistakes.

Don't add unnecessary forward declarations

Why add a forward declaration of my_system() right before the actual implementation? This is an unnecessary repetition of code. It's best to always try to not repeat yourself.

Read the man page again and pay attention to the details

You implemented the call to execl() exactly as written in the man page, but that is only the easy part. You have to ensure that the return value and the behavior in the presence of errors is exactly as the man page describes.

In particular, system() does not call error() when there is an error, instead the return value and the value of errno is used to convey the type of error that has occurred.

Create a test suite before making any changes to my_system()

You could change my_system() right now to fix any immediately obvious errors, but the temptation is very high that afterwards you consider the implementation to be complete. Instead, try to create a test suite first that calls my_system() in different ways to ensure that its behavior matches that given in the man page.
Also, instead of making assumptions of what the required behavior is, in this case you can just check what the actual system() function does.

So such a test suite could look like:

#include &lt;assert.h&gt;
...
const char *commands[] = {
    "/bin/true",
    "/bin/false",
    // add more commands here
    "",
    NULL,
};

for (int i = 0; ; i++) {
    int my_ret = my_system(commands[i]);
    int my_errno = errno;
    int ret = system(commands[i]);
    assert(my_ret == ret);
    if (ret == -1)
        assert(my_errno == errno);

    if(!commands[i])
        break;
}
```