APIs themselves are (probably) not copyrightable and thus copyright licenses do not apply to them. In the particular case of ptrace, it is a "generic" API shared between various OSes so it would be very hard for anybody to actually claim copyright on it.
User-space libraries which happen to make calls to the ptrace API can be under any license they want to be, and therefore if you are using them you must obey their licensing conditions.
So the answer to your question as written is "no, your program does not have to be under the GPL if all you are using are the OS-supplied ptrace APIs". However, it sounds like you may be trying to use libraries which wrap the ptrace APIs, which is a different question.