This sounds like one of those unanswerable thought problems, like "Could God create a rock so big that even He couldn't lift it?". A person given the legal power of forgiveness could theoretically forgive himself, but the deeper question would be who would give someone that much power without any scrutiny? By the time a person reaches the level of a country's leader, he or she has usually been vetted and examined and investigated and checked dozens of times.
People with the authority to keep the president in check wouldn't hesitate to question a decision to self-pardon. I'm sure he or she could get out of a traffic ticket, but if he or she committed a serious felony like mass murder, I don't believe a self-pardon would stand up in a World Court or UN or Supreme Court trial.
I remember hearing that Secret Service agents were once asked by Nixon's chief-of-staff to inform him of any unusual actions by the president during his last few weeks in office. There were apparently some concerns that Nixon would become overwhelmed with emotion and order an unprovoked military action or something equally as irrational. The fact remains that nothing happened. I don't know if another sitting president would ever come close to committing significant criminal acts while in office.
Older white collar crimes may come back to haunt a president, like the Whitewater deal during Clinton's term, but there are too many eyes on a sitting president for him or her to escape notice.