Which comes first? Animal pens or wild sheep?

You can get wild sheep without having pens. They are gained by a map event, a meadow with a sheep, you need to lure it to you. If successful, the wild sheep becomes an item in your inventory and you can activate it to put it in a pen as a lamb.

I strongly recommend you wait to do this until you have at least two wild sheep and four slots in your pen. A wild sheep in your inventory is immortal, a sheep in your pen ages and dies (and rather quickly at that, they have a lifespan of about three weeks) and there is a very limited number of wild sheep (3-5 total) on the entire map.

If you have at least two adult sheep and a free spot in your pen, every day you have a chance a new lamb is born. This becomes self-sustaining at 4 slots in the pen. Putting a single sheep into the pen nets you the benefits for a while, but if it gets old before a new wild sheep is found and grown up, your sheep cannot reproduce and eventually you'll lose them all.

Note: I played the game on release, i.e. April 2018. Since then patches may have changed the behaviour described in the last two paragraphs, so no guarantee it's still accurate.