Whenever you insert an SD card into any camera for the first time, the card must be formatted. This is true for new cards fresh out of the box and it's true for cards that were used in different cameras. The card must be formatted using the camera's format function and never with any other device. NEVER use a computer to format an SD card to be used in a camera. The formatting function writes a file system to the card which is what the camera uses to keep track of which sectors can be written to and which contain data that you want to keep. Using a computer writes a file system that cameras are simply not compatible with.
So, it sounds like you just took the card out of the packaging and placed into the camera and immediately tried to take a photo. This, as you've learned, will not work. The card must first be formatted using the camera's format feature.
If you did format the card in the camera, then make sure that the card is compatible with your camera. As has been written, not all SD cards are alike, nor are they compatible with your camera.