Somalia's dryness despite it's proximity to the equator (which should provide ample opportunities for year round rainfall) has perplexed most meteorologists. In this following answer we will try to explore some of the reasons behind this paradox.
There are three major airflows - the Congo Air(Part of the Congo Air Boundary ) that brings in westerly and south westerly flow to the region and the north east monsoon and the south east monsoon. The issue with both of the monsoons is that the flow is parallel to the shore.
A plot of the climatology of the June- September monsoon(JJAS) shows the winds 850 winds flow parallel to the shore. The winds encounter what is known as a friction differential i.e. the friction over the land is greater than the friction of the ocean surface. Presuming the low pressure is over the land(during the day due to solar radiation) the resulting frictional difference causes the winds to diverge over the coastal areas. For details on this reference (4) explains the math behind it.

The following plot shows the 850 hPa streamfunction over East Africa and is a climatology. Positive values of the streamfunction in the northern hemisphere correspond to low level divergence(enhances subsidence) and negative values to low level wind convergence(enhances ascent). This low level divergence induces subsidence of the air and prevents precipitation.

The climatology of the lower level stream function is shown for the whole year but it does not change much if you take it for any of the two seasons (JJAS) or (NDJF) individually. There is only lower level wind divergence.

The contour lines are the isobars.
I have made my version of Fig 2.29 in (3)(due to copyright) that shows off shore winds parallel to the shore and winds diverging onshore due to the frictional differential. This phenomenon of winds diverging at the coast is not unique to Sonalia but is present everwhere you have coastal deserts and winds flowing parallel to the shore. If the winds did approach the coastline either perpendicular or at an angle then there would be greater low level wind convergence (850 hPa level)as the air would "pile up" at the shore promoting ascent of the air and precipitation. That would be reflected in the climatological 850 hPa wind streamfunction values.
The same off shore south easterly winds cause upwelling along the coast and bring in cooler SSTs. The phenomenon is reversed during the North East Monsoon (Oct - March) the NE winds flow parallel to the shore.
Please note that the lower level wind divergence shown here is for large scale winds and Somalia may indeed get some rains due to a mesoscale phenomenon known as the Sea Breeze front but that depends on whether the coastline is convex or concave over a short distance.
Somalia does get some rains due to the westerly flow due to some combination of mid latitude disturbances and tropical influences and these are known as the Gu rains. The Ethopian Highlands and the East African Rift Valley act as a barrier for the westerly moist laden flow (and the Somalian region is the leeward region) but some amount of moisture does slip by through the transition period in between the two seasons.
Finally reference (2) also talks of the Pacific Warm Pool extending into t he Indian Ocean and the Walker Cell due to the Indian Monsoon westerlies rising over the East Indian Ocean and causing subsidence over the Arabian Sea.
References :
Nicholson, S. E. (2011), Dryland Climatology, 516 pp., Cambridge Univ. Press, New York.Dryland Climatology
Nicholson, S. E. (2017), Climate and climatic variability of rainfall over
eastern Africa, Rev. Geophys., 55,590–635,East African climate and rainfall
Warner, T. T., 2004: Desert Meteorology. Cambridge University Press,
Cambridge, 595 pp
Desert Meteorology
Bryson, R. A., and P. M. Kuhn, 1961: Stress-differential induced divergence with application to littoral precipitation. Erdkunde, 15,
287–294.Friction Induced Differential