as overanalyzer said, you don't have to buy accessories from the apple store to ensure compatibility. but, you may at least want to research what you're thinking of buying in advance (and maybe even use what's available in the apple store as a guide) to ensure compatibility and buy them where you get the best price.
i wouldn't, for example, just buy a non-brand iphone car charger off ebay - i have read horror stories of these chargers frying phones. but, if you can find, say, a genuine griffin powerjolt (i have one of these and it's great) on ebay, then go ahead and buy one...