How to get a particular execute detect command to work

You're very close! The game thinks that /setblock is the block state, so simply add a value for the oak stair before /setblock. Unfortunately, you will need to do it for every block state, unless there is a way of targeting every block type with detect (If there is, please inform me. That would be most useful) Thanks to IronAnvil, I can now inform you that to target any oak stair, simply put -1 as the block state.

In this case, you would go

/execute @a ~ ~ ~ detect ~1 ~1 ~ minecraft:oak_stairs -1 /setblock ~ ~-1 ~ barrier

which would look for oak stairs facing west, to the east of the player, to then place a barrier underneath.

Hope I could help!