"in the best conceivable situation," 1840, from ideal + -ly (2). Earlier "in an archetype" (1640s); "in idea or imagination" (1590s).
Entries linking to ideally
ideal adj.
early 15c., "pertaining to an archetype or model," from Late Latin idealis "existing in idea," from Latin idea in the Platonic sense (see idea). Senses "conceived as perfect; existing only in idea," are from 1610s.
-ly 2
common adverbial suffix, forming from adjectives adverbs signifying "in a manner denoted by" the adjective, Middle English, from Old English -lice, from Proto-Germanic *-liko- (cognates: Old Frisian -like, Old Saxon -liko, Dutch -lijk, Old High German -licho, German -lich, Old Norse -liga, Gothic -leiko); see -ly (1). Cognate with lich, and identical with like (adj.).
Weekley notes as "curious" that Germanic uses a word essentially meaning "body" for the adverbial formation, while Romanic uses one meaning "mind" (as in French constamment from Latin constanti mente). The modern English form emerged in late Middle English, probably from influence of Old Norse -liga.