According to aristotelian humoral theory, which became the cornerstone of medieval medicine (still somewhat recognized up until the end of the 19th century), the spleen was one of the four humoral organs thought to be responsible for a person's moods and emotions.
In a fashion interestingly similar to traditional Chinese medicine, each organ is associated to a substance it produces within the body, and each substance is then associated with a specific type of personality. Strong remnants of this theory can be found throughout modern language in nouns and adjectives still used to describe moods and state of mind (melancholy, humor, bilious etc).
In particular, the spleen was linked to the secretion of black bile, itself seen (for quite obvious psychological reasons) as the cause for a melancholic temperament and linked with all sorts of things "sad" or "gloomy" (earth element, the color black, Autumn, coldness, dryness etc).
The word apparently resurfaced in France toward the end of the 18th century with an identical meaning, though with much more of a poetic license and no longer any serious scientific intent. Redefined by European Romanticism as the ultimate state of despair and melancholy so typical of this 19th century cultural movement, the word was then sent back across the Channel with this additional twist to its definition (this strange type of language ping-pong has been known to happen a lot between French and English). The spleen stood as the antithesis of classicist ideas of rationalism and pondered judgements: an unexplainable unbearable anguish, somewhat precursor of 20th century existential angst.
Among the Romantic artists who shaped this new definition were notably French poets Alfred de Musset and O'Neddy, but above all mad genius and tortured soul Charles Baudelaire:
He was the mere essence of the cursed tormented poet, regularly swept by violent crisis of existential ennui, and it is thus logical that he appropriated the word so completely. He gave it a fundamental role in his lifework as is reflected by his choice of titles: the term appears, not only as the title of numerous single pieces but also as the title of the first (and most powerful, in my opinion) section of Les Fleurs du Mal: Spleen et Idéal, not to mention the Spleen de Paris, a posthumous collection of writings (named so according to his wish).
Of the four poems bearing the title "spleen" presented in Les Fleurs du Mal, the most terrifying and my favorite:
Quand le ciel bas et lourd pése comme un couvercle
Sur l'esprit gémissant en proie aux longs ennuis,
Et que de l'horizon embrassant tout le cercle
Il nous verse un jour noir plus triste que les nuits ;
Quand la terre est changée en un cachot humide,
Où l'Espérance, comme une chauve-souris,
S'en va battant les murs de son aile timide
Et se cognant la tête à des plafonds pourris ;
Quand la pluie étalant ses immenses traînées
D'une vaste prison imite les barreaux,
Et qu'un peuple muet d'infâmes araignées
Vient tendre ses filets au fond de nos cerveaux,
Des cloches tout à coup sautent avec furie
Et lancent vers le ciel un affreux hurlement,
Ainsi que des esprits errants et sans patrie
Qui se mettent à geindre opiniâtrement.
- Et de longs corbillards, sans tambours ni musique,
Défilent lentement dans mon âme ; l'Espoir,
Vaincu, pleure, et l'Angoisse atroce, despotique,
Sur mon crâne incliné plante son drapeau noir.
Spleen LXXVIII,
Charles BaudelaireLes Fleurs du Mal: Spleen et Idéal
Although translating poetry is akin to sketching masterpieces at the museum with a ball pen, here is a translation I found reasonably faithful to the original spirit: nigh impossible to render, though, is the use of very specific alliterations in the French version marking impressions of heavy unbearable calm before the storm, the deafening explosion of pain and finally, the silent surrender to complete anguish):
When skies are low and heavy as a lid
over the mind tormented by disgust,
and hidden in the gloom the sun pours down
on us a daylight dingier than the dark;
when earth becomes a trickling dungeon where
Trust like a bat keeps lunging through the air,
beating tentative wings along the walls
and bumping its head against the rotten beams;
when rain falls straight from underlying clouds,
forging the bars of some enormous jail,
and silent hordes of obscene spiders spin
their webs across the basements of our brains;
then all at once the raging bells break loose,
hurling to heaven their awful caterwaul,
like homeless ghosts with no one left to haunt
whimpering their endless grievances.
- And giant hearses, without dirge or drums,
parade at half-step in my soul, where Hope,
defeated, weeps, and the oppressor Dread
plants his black flag on my assenting skull.
Much could be said about the many other Spleen-related poems in Baudelaire's work and French poetry in general: among other things, its strong, direct or indirect, influence on much of the late 20th century music culture (for better or, quite often too, for worse, although a good influence leading to a crappy result is maybe not the worse thing): think Jim Morrison, Patti Smith, goth kids who like to write poems about teenage lesbian vampyres etc.