Unfortunately, it took them too long to acknowledge and figure out touchscreens, and by then they had dwindled their capital to such a point that a buyout was their only hope of surviving at any rate, and their touch screen phone never shipped. HP buying them out was the worst thing that could have happened, they had no resolve to sustain the phone market, which was and is incredibly competitive. I do feel though, with sustained investment and prioritization, that WebOS could have supplanted Android, particularly if they licensed it (which I think was ultimately what Palm needed to do. Their hardware was never the secret sauce).
FireFox OS was also a valiant attempt at something similar, but Mozilla couldn't quite get it where it needed to be, unfortunately.
disclosure: this is a very biased take, very much my opinions, but I look forward to discussion!
EDIT: To clarify, what I mean by 'figuring out touchscreens' is using one as the primary modality of interaction, sans any hardware inputs (like a hardware keyboard). For instance, the Pre had a touch screen, but no onscreen keyboard, so to type anything into it, you had to slide up the screen.