It would work, but you would not get the same flavours because the components that take place in chemical reactions to produce flavour compounds are different.
During malting, the enzymes in the grain get to work converting complex starches, carbohydrates and proteins into simpler starches, carbohydrates, amino acids, lipids, some reducing sugars and a few other bits and pieces.
Free amino nitrogen (FAN) is also increased during malting which is a building block later on for ester production.
Amino acids and reducing sugars are consumed via Maillard reactions to produce melanoidins which we all know and love for that rich 'malty' flavour that they bring. Melanoidins are also responsible for some colours too.
Total soluble nitrogen is also higher using malt. Yeast like nitrogen.
So yes, it is possible to make beer with only raw barley. But it won't be the same beer.