As some have already said, there's several factors involved in answering this question.
By far the biggest one is how carefully and thoughtfully you handle it. Presuming it doesn't have any factor defects, a well-cared-for Mac should last longer than you need it to.
But given the enormous flux of hardware, software and the internet, most people feel the need for an updated computer after about three to four years, and most manufacturers don't really support machines older than five or six years, so that works out about right.
I still have an original iPhone -- bought first day of issue 3.5 years ago. Still works perfectly. I'm typing this to you on a 2007 Blackbook, about the same age. Still works as well or better than the day I got it (larger HD and more RAM, plus an up-to-date OS). My wife does most of her work on a 2006 Mac Mini. Again, working perfectly.
I'm very likely to upgrade to a 15" MacBook Pro pretty soon and perhaps an iPhone 5 whenever that comes out ... but not because I have to, just because I need to stay closer to the top of the technology curve in my work.